How To

Linking GA4 to BigQuery after setting up Google Analytics 4

Linking GA4 to BigQuery after setting up Google Analytics 4
April 16, 2024

  · 5 min

In this post, we'll look at quickly setting up Google BigQuery and linking your Google Analytics 4 account and why this should be the first thing you should do after creating a Google Analytics Property.

It's free! It's finally free. So back in the day, if you wanted to link Google Analytics to BigQuery you'd have had to pay, and we mean pay a lot because you would have needed a 360 account, and they don't come cheap. Luckily for us, with the arrival of Google Analytics 4 you can now link your GA4 account to BigQuery for free, well basically free. The option is free, like it's there in your settings on the free tier of GA, but technically BigQuery is paid for, but only technically. So yeah, you pay for BigQuery, which in reality means you credit card will be once you go over the free tier which includes 1TB of queries a month and 10GB of storage, which for the average site is a lot, like a lot a lot. So you know, just do it, you most likely won't get charged and if you think that you're gonna be queuing a lot, just set a warning in the billing settings so Google will pop you an email when you're gonna go over budget.

Anyhow, you may ask, why should we care. Well it's a big deal, you can run all kinds of queries on your data, slice and dice it, combine it with other data sources and whatnot, but most importantly you want to do this for two reasons the moment you set up your account.

Reason 1, well you're most likely gonna end up building dashboards in Google Data Studio, and while GA 4 is great, it's fresh out the box and just doesn't do everything you might want it to do in Data Studio, so what you'll most likely end up doing is having 2 data sources for that pretty report of your's. One that's just your vanilla GA4 data source and one that pulling your GA4 data from BigQuery. That should have your bases covered, especially if you're gonna be visualising a lot of stuff around events is GA, the BigQuery data source is great fro that.

Reason 2, and this is the main reason you should be doing this, no data is going to be added to BigQuery retrospectively if you decide you do actually need it 3 months down the line, they still have GA 360 for that, so if you want all your data in BigQuery right from the start, link it up immediately.

Reason3, and this is a big one, and a new one, and we're just gonna add it here now because it really matters in the wake of recent events. Google has in all their wisdom stuck an API limit on the connector for Google Analytics 4 in what is now called Google Looker Studio. Yes, with the acquisition of Looker and the merging of Data Studio and Looker Studio we now have limits on the Google Analytics 4 connector. Now you might say they're not that bad, but they absolutely are as the limits not only apply to usage, so let's say you used 1 token at the arcade to display a graph on the pinball machine, but now your mate John, who is actually your client, Corporation X, logs into the same pinball machine / dashboard in Looker Studio, whoops, usage just doubled, you're out of tokens and the graph stops working. Which is a real crap way of explaining, that every usage limit you just stayed under while you were building a dashboard raises exponentially for every user that goes and looks at said dashboard, or for that matter when anyone else uses the connector, like Susan in marketing who has her own dashboard.

I've said it a few times in our posts, Milk Moon Studio is a design focussed Webflow Studio, we don't want to query anything in SQL in BigQuery, we're Webflow designers, but we want to give our client clean, useful and hopefully free dashboards in what is now Looker Studio, sadly this is no longer a reality with the heavy constraints placed on the GA4 connector, but, as a designer who does not want to get a hand dirty, you can put in a bit of effort, dump the data and BigQuery and build the exact same thing using the BigQuery connector, which has no limit, and is frankly faster than the GA4 way anyway. I urge you, avoid the limitations, put in a bit of sweat the first time and just do it via BigQuery.

One final though, just yesterday, the Google Search Console team announced that BigQuery exports for Search Console will be rolling out over the next week, so add you GA data, because you can now mash it up with Search Console!!!

But before we get started, you may be asking, what exactly is BigQuery, well:

BigQuery is a fully-managed, serverless data warehouse that enables scalable analysis over petabytes of data. It is a Platform as a Service that supports querying using ANSI SQL. It also has built-in machine learning capabilities.

So what does that mean and why do I care? It's a big data warehouse you can use on the cheap, that'll allow you to run a lot of really simple, or really complicated queries really quickly. But guys, you might say, I don't need that, to which we'd say, it also connects directly to Data Studio allowing you to visualise your data in a super simple way, no harder than connecting a spreadsheet.

Anyhow, if you're still on the fence, just take the leap, it ain't gonna cost you and you'll have the data down the line if you end top needing it.

What are you going to need to do this?

1 GA 4 Property (Don't have one? Follow this post)

A Google Cloud Account (Get one here)

Admin rights so they actually link properly

Step 1 - Create a Google API Project

  1. Log in to the APIs Console.
  2. Create a new API Project.
  3. Open the Nav Menu top left, click APIs and Services and then click Library.
  4. Under Google Cloud APIs, click BigQuery API and then Enable.
  5. If you're new here do the terms and conditions bit.
  6. Open the Nav again and head to billing, you don't want the free sandbox and your data will eventually be deleted.
  7. Setup a billing account.
  8. Go to
  9. Create and new data set, if this works your billing is set up.
  10. Now you're going to need a service account (this is the bit about the permission).
  11. Add analytics-processing-dev@system.gserviceaccount.com as a member of the project, and ensure that permission at the project level is set to Editor (as opposed to BigQuery Data Editor). Editor permission is required in order to export data from Analytics to BigQuery.

Step 2 - Link GA4 to Big Query

Go to you GA settings and click on BigQuery Linking

BigQuery Linking in Google Analytics Admin Panel
BigQuery Linking in Google Analytics Admin Panel

Click Link to create the link.

Create Link to BigQuery
Create Link to BigQuery

Click Choose BigQuery Project

Choose BigQuery Project
Choose BigQuery Project

Choose BigQuery Project

Choose the BigQuery Project
Choose the BigQuery Project

Now select the region to run queries, if there are any GDPR implications to what you're doing you're gonna want to go with the EU.

Select BigQuery data location
Select BigQuery data location

Now you're going to select your datastream and the frequency, we usually don't bother with streaming, once a day should be just fine for most things. All this means is that you'll always have the data from the day before as the latest data in BigQuery.

Click submit and you're done.

Submit the link to BigQuery
Submit the link to BigQuery

Sometime in the next day you data will start appearing in BigQuery. So, wait a day, head to Data Studio, create a new Data Source select BigQuery and your GA dataset will be there. We'll do a few posts on Google Analytics datasets in Google Data Studio at some point. In the meantime, remember that you now have GA data in an easy to use Data Warehouse, you can move data to other cloud platforms like Azure or AWS, you can use other tools like Tableau and PowerBI to visualise your data, all because it's nice, tidy, and safe in BigQuery. Enjoy and if you have anything to add or ask hit us up in the comments.

Remember to check out the How-To section of our blog for more tutorials like setting up Tag Manager in Webflowadding GA4 to Tag manager, tracking form submissions, or clicks.

Share

All Posts

Gradient Background