This message was deleted.
# ask-questions
w
This message was deleted.
h
It looks like you might be missing an id field (such as a user_id). You will need this for user assignment/randomization in your experiment
a
Still facing the same issue. Hmm, do you guys have a mock repo anywhere that I can compare it with?
h
we do have this: https://github.com/growthbook/examples If you're still having trouble, post some sample implementation code that involves setting the hashAttribute (id). Also check out our devtools Chrome extension for easier debugging: https://chromewebstore.google.com/detail/growthbook-devtools/opemhndcehfgipokneipaafbglcecjia
a
Thanks! And here's some implementation code I've been running on a separate repo.
Copy code
create_UUID = () => {
    let dt = new Date().getTime();
  
    let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
       let r = (dt + Math.random() * 16) % 16 | 0;
       dt = Math.floor(dt / 16);
       return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);
    });
    return uuid;
}

let visitor_id = localStorage.getItem("growthbook_visitor_id");

if (!visitor_id) {
  visitor_id = create_UUID();
  localStorage.setItem('growthbook_visitor_id', visitor_id)
}

const growthbook = new GrowthBook({
  apiHost: process.env.GATSBY_GROWTHBOOK_API_HOST,
  clientKey: process.env.GATSBY_GROWTHBOOK_CLIENT_KEY,
  enableDevMode: true,
  attributes: {
    id: visitor_id,
    url: window.location.href,
  },
  trackingCallback: (experiment, result) => {
    const params = new URLSearchParams(window.location.search)
    const version = params.get(`gb-${experiment.key}`)

    if (version) return

    localStorage.setItem(`growthbook_experiment_${experiment.key}`, result.key)

    window.analytics.track('Experiment Viewed', {
      experimentId: experiment.key,
      variationId: result.key
    })
  },
});
• I added
url
as an attribute in our Growthbook SDK • Toggled Visual Editor in the Growthbook app's SDK Configuration setting • Added the Growthbook Chrome Extension The docs have been very straightforward and simple. Not sure what I'm exactly missing 😅
h
does the chrome extension show that experiments were found on the page?
also noticed that your exp targets
<http://localhost:8001/>
. Is this the url you use to access the site?
f
Can you make sure the SDK is passing the visual editor changes? (edit the sdk and check for the 'include the visual editor' is selected
196 Views