Configuring GrowthBook to use Google Analytics GA4 as a data source
GrowthBook connects to Google Analytics (GA4) via BigQuery. This process is straight forward, and outlined below. You can also find Google’s documentation on how to create this link here.1. Create a BigQuery Project (if you don’t have one)
If you don’t have a BigQuery project, you’ll need to create one. Go to your Google Cloud Console and create a new project:


Using the BigQuery sandbox projectIf you are just testing GrowthBook with GA4 out, you can use the sandbox project that Google provides for free. When you create a new cloud project the sandbox should be automatically enabled. You can find more information about the sandbox here.
2. Connect Google Analytics to BigQuery
Log into your Google Analytics account and navigate to the Admin section. From there, make sure you have selected the right property, and scroll down to Product Links section. Click on the menu named BigQuery Links






Loading Google Analytics via Google Tag Manager (GTM)If you are loading Google Analytics via Google Tag Manager (GTM), you may need to add the custom event to GTM to ensure
the data is passed to GA4 from the datalayer. You can add the custom event by following this section from the GTM guide. Our Google Tag Manager (GTM) Troubleshooting Guide may be helpful for debugging if needed.
3. Configure BigQuery for GrowthBook
You’ll need to give GrowthBook permissions to your BigQuery project so that we can access the data. We have created a guide just for this, which you can find here4. Connect GrowthBook to BigQuery
Within GrowthBook, navigate to the Analysis section, and then click on the Data Sources page. Add a new data source, and select Google Analytics (GA4).

Automatic SQL query creationWhile GrowthBook will pre-populate the SQL queries for you, you may need to adjust the experiment query to match your
data depending on the way you are tracking your experiments (see the trackingCallback below).
Running experiments with GrowthBook and GA4
With the data source connected, you can integrate the GrowthBook SDK into your application to run A/B tests. Once implemented, the SDK will do the random assignments and send the experiment exposure event to GA4 based on the settings in the GrowthBook UI.Visual editor for creating experimentsWe do have a visual editor for creating experiments as part of our Pro plan. Our visual editor is meant for simple
experiments. Experiments that are more complex are best created by writing code with feature flags.
SDK integration for GA4
The easiest and recommended way to integrate GrowthBook is by using our Script Tag SDK. This SDK will work out-of-the-box with GA4 without any configuration required.Debugging GA4 integrationsIf your experiment is not firing the
trackingCallback you can use our
Chrome developer tool
to help you debug and make sure the user attributes are being set correctly.
