Hello everyone, we currently have some AB tests do...
# announcements
e
Hello everyone, we currently have some AB tests done through GrowtBook but it seems we only get a sample of the data. E.g., we have a page that gets more 2 000 unique page views per week (based on Google Analytics and other sources) but Growthbook shows that we only have about 400 people in the AB test running on the page. Our GrowthBook is connected to GA and even metrics seem to work but the data is different. Any ideas why this could be? :)
f
When you added the GrowthBook SDK, what did you put for the trackingCallback?
e
Copy code
trackingCallback: (experiment, result) => {
            try {
                // @ts-ignore
                const localDataLayer = window?.dataLayer || [];

                const event = {
                    event: 'experiment',
                    experiment: experiment.key,
                    variation: result.variationId,
                    sessionId: pageProps?.sessionId || Cookie.get('sid'),
                };
                localDataLayer.push(event);
            } catch (error) {
                // silences the error in dev mode
            }
        },
f
If you look in GA do you see those events being fired the expected number of times?
It looks like you might be doing SSR with something like Next.js. window.dataLayer won't exist during the server render, so the tracking might not be working as expected.