https://www.growthbook.io/ logo
#announcements
Title
# announcements
n

nutritious-beach-21644

08/11/2023, 11:06 PM
The Documentation about the tracking callback not firing states that : •
The feature is disabled for the environment you are in (dev/prod)
. I see my environment turned "on" for the feature in question. • It states that I could be missing a hashAttribute. in the feature view, I see
SPLIT users by id
, and I am sending the browser-generated ID when I instantiate Growthbook:
Copy code
attributes: {
  id: growthbook_user_id
},
• It states that coverage could be an issue: I have my experiment coverage turned up to 100% traffic. • It states that there is another feature rule taking precedence. I only have 1 feature and 1 experiment. Finally, when I open the devtools, I can see my feature "lead-form-updates". When I run
growthbook.evalFeature("lead-form-updates")
I see "source: unknownFeature"
Copy code
{value: null, on: false, off: true, source: 'unknownFeature', ruleId: ''}
f

fresh-football-47124

08/11/2023, 11:07 PM
Is it waiting for the fetch call?
n

nutritious-beach-21644

08/11/2023, 11:07 PM
can you shed any light on the
source: 'unknownFeature'
message?
f

fresh-football-47124

08/11/2023, 11:07 PM
You might need a loadFeatures()
n

nutritious-beach-21644

08/11/2023, 11:09 PM
Copy code
if (typeof window !== 'undefined') {
  // get existing growthbook user
  const growthbook_user = window.sessionStorage.getItem("growthbook_user_id")
  let growthbook_user_id
  if (growthbook_user) {
    growthbook_user_id = growthbook_user
  } else {
    // generate a growthbook userID and set it
    growthbook_user_id = uuid()
    window.sessionStorage.setItem("growthbook_user_id", JSON.stringify(growthbook_user_id))
  }

  growthbook = new GrowthBook({
    apiHost: "<https://cdn.growthbook.io>",
    clientKey: "sdk-cKFk90qAra2QhKcY",
    attributes: {
      id: growthbook_user_id
    },
    enableDevMode: true,
    trackingCallback: (experiment, result) => {
      console.log('wth')
      // track using GA4
      window.gtag("event", "experiment_viewed", {
        event_category: "experiment",
        experiment_id: experiment.key,
        variation_id: result.variationId,
      })
    }
  })
  // Load features from the GrowthBook API
  growthbook.loadFeatures()

  if ("gtag" in window) {
    window.dataLayer && window.dataLayer.push({
      user_id: growthbook_user_id,
      client_id: growthbook_user_id
    })
  }
}
^ this where I landed using session storage for the uuid
f

fresh-football-47124

08/11/2023, 11:10 PM
Okay
n

nutritious-beach-21644

08/11/2023, 11:10 PM
Screenshot 2023-08-11 at 4.09.28 PM.png
f

fresh-football-47124

08/11/2023, 11:10 PM
Okay, seems to be working
n

nutritious-beach-21644

08/11/2023, 11:10 PM
Should I see the experiment listed under "Experiments" here?
f

fresh-football-47124

08/11/2023, 11:11 PM
Yes, if there is an experiment rule
n

nutritious-beach-21644

08/11/2023, 11:12 PM
Oh okay. I was assuming it wasn't working since I wasn't getting a log out of the trackingCallback and the feature is always
false
.
Experiment rule == targeting condition?
f

fresh-football-47124

08/11/2023, 11:22 PM
no, an experiment rule is an experiment rule
11 Views