Two issues, same task. Client of mine tried to do ...
# ask-questions
b
Two issues, same task. Client of mine tried to do a visual experiment and claims when they started running it, the website encountered a server error that shut it down. So they had to stop running it. When I went to investigate, I create a duplicate of their experiment and ran it. I waiting about 10-15 minutes, and nothing shut down -- however my GB extensions also weren't picking up the new experiment as something that existed. I'll attach some screenshots in the thread
Screenshot 2025-05-12 at 8.34.43 AM.png,Screenshot 2025-05-12 at 8.35.17 AM.png,Screenshot 2025-05-12 at 8.35.01 AM.png,Screenshot 2025-05-12 at 8.34.53 AM.png
s
With the screenshots you shared, I think the experiment is still in draft state. Have you hit Start Experiment after the fact?
b
Yes, that was before I hit Start Experiment
how long after i start an experiment should i see it showing up in the developer tool chrome extensions
and is it possible its not playing nicely because of the custom implementaiton we have for a different experiment where everything is brought in via custom Js in our site's library?
s
There could be an issue there, but I don't even see the experiment in your SDK payload. It would appear immediately when the experiment is running, as long as it was created under the relevant project/environments.
b
ive already stopped it, because of the clients claim that it was shutting down their server when they ran one
im curious what could be causing that, if anything
s
It's hard to say without more info. I haven't seen any similar reports before that I can remember. The only possibility I can think of is that the implementation somehow introduced an infinite loop that caused the page to crash. But I'm not sure...
b
@strong-mouse-55694 We just activated 2 experiments and im not seeing them in the dev tools
Screenshot 2025-05-13 at 12.36.37 PM.png,Screenshot 2025-05-13 at 12.36.18 PM.png
s
I see
Groove Test - RedCloseoutButton
in your API response. However, I can also see that it's not being passed to the SDK, which is why it isn't showing up. I think you had some custom logic, so you need to not only pass
features
but also
experiments
in order for things to work. You can see your raw API response here (what's being sent to your site): https://cdn.growthbook.io/api/features/sdk-z2eQdvHSoRomlSFH With Dev Tools, you can compare what it's getting (SDK → SDK Payload) and see that the experiments property is empty. With the other visual experiment, I'd need more details to understand why it's not included in the payload.
b
Groove mini cart test is not the same as the Red Closeout button
So I updated the custom logic
Copy code
const response = await fetch(`<https://cdn.growthbook.io/api/features/sdk-z2eQdvHSoRomlSFH>`);
      const { features } = await response.json();
      
      // Initialize GrowthBook with the features
      const pluginOptions = {
        trackers: ["gtag"]
      }
      const gb = new GrowthBook({
        enableDevMode: true,
        features,
        experiments,
        apiHost: "<https://cdn.growthbook.io>",
        clientKey: "sdk-z2eQdvHSoRomlSFH",
        plugins: [
          thirdPartyTrackingPlugin(pluginOptions),
        ],
        attributes: {
          id: visitor_id, // Use the anonymous ID for user identification
        }
      });
I added experiments and now its saying there's no SDK at all
experiments is not defined, whoops
s
I think you'd need this:
const { features, experiments } = await response.json();
I know you're using this custom logic because of some particular needs with your app, but I think you'd likely face fewer challenges following the path laid out in the docs. It'd handle all of this data fetching (caching, etc.) for you.
b
i got it working by adding an initializer, suggested by your AI on the dev docs
Copy code
const response = await fetch(`<https://cdn.growthbook.io/api/features/sdk-z2eQdvHSoRomlSFH>`);
      const { features } = await response.json();
      
      // Initialize GrowthBook with the features
      const pluginOptions = {
        trackers: ["gtag"]
      }
      const gb = new GrowthBook({
        enableDevMode: true,
        features,
        apiHost: "<https://cdn.growthbook.io>",
        clientKey: "sdk-z2eQdvHSoRomlSFH",
        plugins: [
          thirdPartyTrackingPlugin(pluginOptions),
        ],
        attributes: {
          id: visitor_id, // Use the anonymous ID for user identification
        }
      });
      await gb.init({
        timeout: 2000,
        streaming: true // replaces autoRefresh
      });
s
Nice. If you're doing init like that, you shouldn't have to fetch from the cdn at all. It'll be taken care of for you: https://docs.growthbook.io/lib/js#step-1-configure-your-app