A somewhat stupid question: When adding Growthbook...
# ask-questions
r
A somewhat stupid question: When adding Growthbook to our site (react) we need to send the information to GA4 (in our case) about which variation a user got. As I understand it that is done in a callback function called by GrowthBook when needed (
trackingCallback
). But What I don't find (or understand) is how the GA4 event needs to be structured so that it can be understood by GrowthBook once it ends up in BigQuery? Is there an example somewhere for GA4?
DISCLAIMER: I'm a backend guy so these frontend technicalities are not my strongest skill! 😄
f
In GrowthBook, you can customize the SQL used to pull the data out of BigQuery, so we're super flexible with how you store it. Something like this should work fine:
Copy code
gtag('event', 'viewed_experiment', {
  experiment_id: experiment.key,
  variation_id: result.variationId
});
r
OK! 👍 Thanks again @future-teacher-7046! 🫶