How to Export Data from GA4 to BigQuery [2022]

Insight

Exciting news on the Data Warehousing front! With GA4, users can now leverage a feature previously reserved for GA360 customers: the ability to raw export all GA4 data directly into BigQuery.

We’ll first explain what this new functionality means for you, and then we’ll provide a step-by-step guide on how to get it set up. 

What does this export functionality mean for users, and why is it useful?

Now, when you enable the GA4 to BigQuery export, Google will automatically populate a BigQuery database (that’s owned by your brand) that includes data about every hit sent from your site to GA4 (often within minutes of being tracked). 

This new piping power means that you won’t have to involve APIs or third-party tools to sync your raw GA4 data in BigQuery. 

Instead, Google will automatically push the data, which means you can immediately start extracting insights (perhaps with some assistance from an analytics platform) via more complex analyses that wouldn’t be possible in the GA4 interface. Additionally, you will be able to run analyses in BigQuery based on zero sampling—as opposed to reports based on sample data + extrapolation within the GA4 UI. 

Get GA4 and BigQuery connected as soon as possible

If you’ve already set up your GA4 and have data flowing in, we strongly recommend setting up the BigQuery export as soon as you can (If you need help getting started on GA4, we have a complete GA4 setup guide).

The biggest reason is that the export is not retroactive. This means that if you started tracking with GA4 in January 2022 and you don’t set up your BigQuery export until August 2022, your BigQuery export will only contain data from August onwards. Therefore, you’ll be limited to the GA4 UI or API to analyze data from before then. 

Getting up and running: a step-by-step walkthrough for the GA4 to BigQuery export

First of all, you will have to enter credit card info to get this export set up. But it’s unlikely that the ultimate cost will be more than a nominal fee.

Google Cloud Platform (the platform that BigQuery lives within) charges based on usage, and it charges for storage and analysis separately. For example, a mid-sized brand that works with Daasity paid less than $5 last month for storage and less than $5 for a month’s worth of analysis.

Initial setup process

1. If you don’t have a Google Cloud Platform account, you’ll need to create one at console.cloud.google.com.

2. Once you’re in, create a new project by clicking Select a project in the top navigation:


 

3. Then, select NEW PROJECT in the upper right:

4. Give your project a name, and create it.

5. Choose APIs & Services from the left-hand menu, and then click on Library.

6. Find and enable the BigQuery API. It may already be enabled by default, in which case the only option will show MANAGE. If this is the case, you can ignore this step.

7. Navigate to IAM & Admin in the left-hand menu, and click on IAM

8. Add a new user to the account. Under New Principals, use the email firebase-measurement@system.gserviceaccount.com, and give it the role of Editor

9. If you want to get a real-time export of data from GA4 to BigQuery, you’ll need to create a billing account.

Pro tips on account setup:

It’s necessary to think long-term when setting up a billing account. You cannot transfer a billing account between Google accounts, so we strongly recommend that you set up the billing account with a “master” corporate Google account that someone in your company will always have access to.

To do this:

  1. Create a billing account for that “master” corporate Google account, then add that “master” Google account as a member of the project that you’re syncing to BigQuery.
  2. Once you’ve added the account, link the project to that billing account.

Linking your GA4 account to your BigQuery account and setting up the export

1. First, sign in to Google Analytics. Use an email address that has Owner access to the BigQuery project, and also has an Editor role for the Analytics property that includes the data stream you want to link.

2. In Admin, make sure that you have the desired account and property selected.

3. In the Property column, under PRODUCT LINKS, click BigQuery Links:

4. Click Link.

5. Click Choose a BigQuery project to display a list of projects for which you have at least read permission. If you have linked Analytics and Firebase (or plan to), consider exporting to the same cloud project. This will facilitate easier JOINs with other Firebase data.

6. Select a project from the list, then click Confirm.

7. Select a location for the data. If your project already has a dataset for the Analytics property, you can't configure this option.

8. Click Next.

9. Select Configure data streams and events to select 1) the data streams to include with the export and 2) specific events to exclude from the export. You can exclude events by clicking Add to select from a list of existing events. Alternatively, you can click on Specify event by name to choose existing events by name (or to specify event names that have yet to be collected on the property).

10. Click Done.

11. Select Include advertising identifiers for mobile app streams if you want to include advertising identifiers.

12. Select either a Daily (once a day) or Streaming (continuous) export of data (or both!). Note: if you don’t choose Streaming, you will not get real-time data in your BigQuery export.

13. Click Next.

14. Review your settings, then click Submit.

15. Export setup is now complete! 

Okay, what now?

After you’ve set up the link, it will take about 24 hours for Google to start populating your data in BigQuery. Once you see data flowing in, you can sit back and relax: you won’t have any gaps in your data!

If you want to learn more about querying and analyzing the data (there’s definitely a learning curve if you’ve never worked with raw Google Analytics data in BigQuery before), here are some great resources:

Resources from Google:

Other resources from around the web:

May interest you

Stay Data-Driven.

Get tactical insights delivered to your inbox.

< src="https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js" defer>