Hey guys, I'm having an issue running a visual edi...
# ask-questions
n
Hey guys, I'm having an issue running a visual editor test. I created a test in the Project, the test is currently running. I set up the SDK connection via JS including the following script:
Copy code
<script id="growthbook-sdk" src="<https://cdn.jsdelivr.net/npm/@growthbook/growthbook/dist/bundles/index.min.js>" defer></script>
Then I have a code that watches whether the growthbook variable is ready and/or the script finished loading and it creates the growthbook instance. The instance looks as follows:
Copy code
const attributes = {
    id: generate_my_user_id(),
    user_id: generate_my_user_id(),
};

let growthbook_instance = new growthbook.GrowthBook({
    apiHost: "<https://cdn.growthbook.io>",
    clientKey: "sdk-XXXXXXXXXXXXXX", //the actual code goes here, I replaced it JIC
    enableDevMode: window.location.search.includes('debug') || window.location.href.includes('dev.'),
    subscribeToChanges: false,
    attributes: attributes,
    trackingCallback: (experiment, result) => {
        console.log("Viewed Experiment", {
            experimentId: experiment.key,
            variationId: result.key
        });

        if ("gtag" in window) {
            window.gtag("event", "experiment_viewed", {
                event_category: "experiment",
                experiment_id: experiment.key,
                variation_id: result.variationId,
                
            });
        } else {
            console.log("no gtag");
        }
    }
});
growthbook_instance.loadFeatures();
I have the Chrome Dev Extension tool installed. The problem I'm having is that the Chrome extension is seeing feature flags I have defined, but it is not seeing any experiments, thus the users are not getting any changes done in the visual editor. I'm not seeing trackingCallback being executed either. Can anyone point me in the right direction? Thanks!
Nevermind, setting the SDK Connection to just the project I'm working on fixed the issue. Thanks!
f
👍