nutritious-beach-21644
08/10/2023, 9:26 PMconst growthbook = new GrowthBook({
apiHost: env.GROWTHBOOK_HOST,
clientKey: env.GROWTHBOOK_KEY,
attributes: {
id: Date.now()
},
trackingCallback: (experiment, result) => {
// track using GA4
if ("gtag" in window) {
window.gtag("event", "experiment_viewed", {
event_category: "experiment",
experiment_id: experiment.key,
variation_id: result.variationId,
})
}
}
As I understand it, this puts a user into the experiment... by sending an event to GA? Also, I'm using Date.now()
for the attributes.id
because we only have anonymous users (docs). I'm suspicious of this approach and open to any suggestions for a better path.
We also send a tracking event to GA; the event name is "Submit" and the event category is "Lead Form". (Long story short, we are testing if changes to our lead form steps will increase conversion).
// The submit button was clicked
tracker.event('Submit', {
event_category: 'Lead Form',
})
As I understand it, this is the event we need to use as a Growthbook metric to define whether or not the experiment was successful or not.
GA4 to BigQuery
I'm very uncomfortable using BigQuery. It's my first time, but I have somebody to help me. I worked through the documentation to set this up with a service account.
When I look in the BigQuery dashboard, I see an events_
table. I didn't put this there. Did Growthbook do this? I feel that this might be a missed opportunity in the documentation for laymen like me; how does my Google Analytics data translate into BigQuery?
BigQuery to GrowthBook
I'm still learning my way around the Growthbook dashboard, but I've been able to make some progress setting up a Metric to connect to our BigQuery instance. I have a Metric that I'm calling "Lead form submission". As I understand it, the goal here is to Select rows from that events_
table to find rows where the event_name
matches my GA4 tracker event.fresh-football-47124
fresh-football-47124
nutritious-beach-21644
08/10/2023, 9:31 PMfresh-football-47124
fresh-football-47124
fresh-football-47124
fresh-football-47124
nutritious-beach-21644
08/10/2023, 9:34 PMfresh-football-47124
nutritious-beach-21644
08/10/2023, 9:39 PManalytics_* is the project ID, and events_ is the database name
fresh-football-47124
nutritious-beach-21644
08/10/2023, 9:41 PMnutritious-beach-21644
08/10/2023, 9:41 PMfresh-football-47124
fresh-football-47124
nutritious-beach-21644
08/10/2023, 9:44 PMuser_id
to Date.now()
? I'm thinking this could be how Growthbook is going to try to connect a user from an Experiment to a result in the Metrics...nutritious-beach-21644
08/10/2023, 9:44 PMfresh-football-47124
fresh-football-47124
fresh-football-47124
fresh-football-47124
nutritious-beach-21644
08/10/2023, 9:46 PMnutritious-beach-21644
08/10/2023, 9:46 PMfresh-football-47124
nutritious-beach-21644
08/10/2023, 9:46 PMfresh-football-47124
nutritious-beach-21644
08/10/2023, 9:48 PMfresh-football-47124
fresh-football-47124
silly-fall-70535
08/11/2023, 12:35 AMsilly-fall-70535
08/11/2023, 12:36 AMfresh-football-47124
fresh-football-47124
silly-fall-70535
08/11/2023, 12:37 AMsilly-fall-70535
08/11/2023, 12:38 AMsilly-fall-70535
08/11/2023, 12:38 AMfresh-football-47124
silly-fall-70535
08/11/2023, 12:39 AMsilly-fall-70535
08/11/2023, 12:39 AMfresh-football-47124
silly-fall-70535
08/11/2023, 12:39 AMfresh-football-47124
silly-fall-70535
08/11/2023, 12:42 AMsilly-fall-70535
08/11/2023, 12:53 AMsilly-fall-70535
08/11/2023, 7:03 PM