Hello GrowthBook! I'm currently trying a visual ex...
# ask-questions
h
Hello GrowthBook! I'm currently trying a visual experiment that gives me this code sample
Copy code
{
  "mutations": [
    [
      "#__next > div:nth-child(1)",
      "set html",
      "Foo bar version"
    ]
  ],
  "css": ""
}
Where do I need to put it in order to have my experiment displayed in my website?
f
If you go to the settings page, you should see a code snippet for how to load the visual editor on your website
h
So I need to put it in the
Copy code
window.GROWTHBOOK_CONFIG
object?
f
you don't need to put that mutations code anywhere. In the code snippet, it references a javascript file that will already have that code in it
h
Ok! I must have missed something else then 🙂 Thx for your help!
Can you please help make this work @future-teacher-7046? I've followed all the steps and the script seems to be well charged on my page, but I can't see any change
f
Do you see anything in the browser dev tools console on your site?
h
I don't have any error, but I can see objects of different types, with my experiment in it
f
Can you dm me the URL and I can take a look?
h
i'm running it in localhost, maybe the issue comes from this?
FYI my localhost page is well displayed in the visual studio of GrowthBook
f
if it works in the visual editor, then that means the script loaded correctly. It might be a problem with the targeting conditions of the experiment. If the URL doesn't match properly then the test won't run
Or if you are targeting the experiment to logged-in users, but your GROWTHBOOK_CONFIG doesn't have a
userId
set.
h
It's working! I miss-understood
the experiment "tracking key"
from your doc to pass as URL param I was passing
register_button
instead of
register-button
because here
Copy code
const growthbook = new GrowthBook({
    trackingCallback: (experiment, result) => {
      console.log({
        experimentId: experiment.key, 
        variationId: result.variationId
      })
    }
  });
experimentId: "register_button"
😅