I'm using growthbook with a nextjs app... Weirdnes...
# ask-questions
s
I'm using growthbook with a nextjs app... Weirdness is going on where locally I get the experiment but on production I don't...
Copy code
const growthbook = new GrowthBook({
  apiHost: process.env.NEXT_PUBLIC_GROWTHBOOK_API_HOST,
  clientKey: process.env.NEXT_PUBLIC_GROWTHBOOK_CLIENT_KEY,
  enableDevMode: process.env.NODE_ENV === 'development',
  trackingCallback: (experiment, result) => {
    console.log('Viewed Experiment', experiment, result);

    if ('gtag' in window) {
      (window as any).gtag('event', 'experiment_viewed', {
        event_category: 'experiment',
        experiment_id: experiment.key,
        variation_id: result.variationId,
      });
    } else {
      console.warn('no gtag');
    }
  },
});
locally i get the console log for Viewed Experiment. On Prod I don't get any logs at all... Very strange... The only difference should be enableDevMode (I tested locally the production build...)
f
I assume this is part of the code
s
Correct... What could be a reason that tracking callback doesn't get called? It is so weird that it works on dev but not in production mode. No error logs (env bars are properly set...) . In dev tools network tab I see successful requests to growthbook
:( no data seems to be sending for the experiment I have running (it has been a couple days)
Ok got the chrome extension and I see
Skip because missing hashAttribute
Alright issue was needing to set client ID I guess... Crossing fingers this did the trick
1
b
was this it @silly-fall-70535?
f
usually lack of trackingCallback calls is because the attributes are not set
1