Hey guys! I'm new to GrowthBook and I've been goin...
# ask-questions
m
Hey guys! I'm new to GrowthBook and I've been going through the docs. I'm trying to integrate Feature Flags with our Shopify site. I didn't see any documentation specific to Shopify, so I've been referring to the Javascript SDK docs. Following those instructions, whether I use the cdn OR install the module, I can't get past the first step. The
import { GrowthBook } from "@growthbook/growthbook";
never successfully imports and always prints out
Uncaught TypeError: Failed to resolve module specifier "@growthbook/growthbook". Relative references must start with either "/", "./", or "../".
. Is this something you can help me resolve?
s
Hi @miniature-television-64304 We actually just shipped our Shopify documentation earlier today. Would you try taking a look and see if it helps you get setup? https://docs.growthbook.io/integrations/shopify
m
Oh wow 😂 That's awesome! I'll take a look and get back to you. Thank you!
Okay so just to confirm: With the Shopify documentation, it looks like we only have the route of using the Visual Editor as opposed to using feature flags. Is that correct?
s
That's the quickest way. But it is possible to utilize feature flags, too. YOu'd have to write custom JavaScript in your shopify app, and probably use our CDN URLs to import the GrowthBook SDK
Our GTM doc is probably the closest example to an approach like that, though you'll have to figure out where in Shopify to do it: https://docs.growthbook.io/guide/google-tag-manager-and-growthbook
m
Perfect! 🙂 Thanks for the direction, I'll check it out!
s
Sure, feel free to reach out with any questions
👌 1
m
Hey so I have 2 questions. 🙂 I'm using the
Strategy 1: Page speed optimized, inline experiments
strategy described in the GTM docs. I have it set up with a little test experiment and it appears to be working. I can grab the value from the variation that the user is assigned and create logic from there. My 2 questions are: 1. I noticed that the
apiHost
and
clientKey
connection parameters aren't a requirement for this strategy. Why is that the case? 2. If I'm setting
key
,
variations
,
weights
, and
coverage
here in my code, how would it interact with the settings I set up in my features on GrowthBook? Does it not interact with the features set up there at all? If so, does that mean it only tracks data based on the
trackingCallback
? And not in any way that the results can be viewed in the experiment results tab on GrowthBook? Thanks for any assistance!
s
That’s correct - it’s meant as a way to ‘hardwire’ your local growthbook SDK in the case where performance really matters. It won’t transmit results to your growthbook host and you won’t be able to view results in your experiments tab.
m
Okay perfect, thanks for the clarification! So the
Strategy 2: Flexible feature flags, less performant
does load the feature information from GrowthBook? As well as store the results for us in the results tab?
Using the second strategy listed in the docs:
Copy code
gb.loadFeatures().then(function() {

        // 2-way test using a boolean feature flag
        if (gb.isOn("green-button")) {
          document.querySelector("#button-1").classList.add("green");
        }

      });
We have an A/B feature set up with a control set to "Off" and a variant set to "On". Default value is "Off" and it's set to include 100% of traffic. When using the method above^, we aren't seeing any results in the results tab. We are instead seeing the error
Unknown experiment assignment table - anonymous_id
. Does this have to do with our ID we're passing in the attributes? Or something else?
s
Check out your data sources in the Growthbook UI and see if you have an identifier table set up for
anonymous_id
m
Oh thank you! It looks like the query is requiring user_id. So I guess I can't just switch the Sample Data Source to
anonymous_id
?
Oh no, I was able to switch it to
anonymous_id
, but I'm still getting the error. So there must be more to it.
r
Hi Jeremiah, which data source are you using? The error "Unknown experiment assignment table - anonymous­_id" suggests that GrowthBook is trying to access a table called ​`anonymous­_id`​, which likely does not exist. This error can occur if there is a misconfiguration in your experiment setup, particularly in the Experiment Assignment Query or the data source configuration. To fix this error, you should: 1. Verify that your Experiment Assignment Query is correctly written and does not mistakenly reference ​`anonymous­_id`​ as a table. Instead, it should be a column in the query if you are using it as an identifier. 2. Check your data source configuration to ensure that it is correctly set up and that the schema is properly defined. You can send me screenshots of the data source configuration and the Experiment Assignment Query, as well.
👀 1