How to Connect Google Analytics 4 to BigQuery
Getting your hands on raw, unsampled data from Google Analytics 4 can feel like a game-changer for deep analysis, but the path to get there isn't always obvious. Connecting GA4 to BigQuery unlocks the true power of your analytics data, freeing you from user interface limits and data sampling issues. This guide will walk you through exactly how to set up the GA4 to BigQuery export, why it's worth your time, and how to start running your first basic queries.
Why Connect GA4 to BigQuery in the First Place?
Before diving into the steps, it helps to understand what you gain from this integration. The standard GA4 interface is great for day-to-day reporting, but for serious analysis, it has a few significant limitations that the BigQuery connection solves.
1. Overcome Data Sampling
You've probably seen this message in GA4 when you create a complex exploration: "This report is based on N% of available data." GA4 uses data sampling to provide reports quickly, especially on high-traffic sites or with long date ranges. This means it's estimating results based on a subset of your data. While often good enough for general trends, it's not ideal for financial reporting or granular analysis where precision matters. The BigQuery export sends all your raw, unsampled data, giving you 100% accuracy.
2. Access Raw, Event-Level Data
GA4 is an event-based model, and everything a user does — from a page_view to a purchase — is an event. In BigQuery, you get a clean, row-by-row log of every single one of these events for every user. This allows you to perform highly detailed user journey analysis, build custom attribution models, or segment users in ways that are simply impossible in the standard GA4 UI. You can analyze the full customer journey from the first touch to the final conversion, something you can't see on its own in the GA4 platform dashboards and reports.
3. Break Free from Data Retention Limits
In GA4, granular data about events and users is automatically deleted after a maximum of 14 months. This makes long-term, year-over-year analysis on specific user cohorts impossible after that period. In contrast, once your data is in BigQuery, it's yours to keep forever. You can store years of historical data without any retention limits, building a priceless long-term asset for trend analysis.
4. Combine GA4 Data with Other Business Data
Your web analytics data is powerful, but it's even more valuable when combined with data from other platforms. In BigQuery, you can join your GA4 data with information from your CRM (like Salesforce or HubSpot), advertising platforms (Facebook Ads, Google Ads), or payment processors (Stripe). This enables a complete, 360-degree view of your business, allowing you to answer complex questions like, "What is the true lifetime value of customers acquired through our paid search campaigns?" without having to export multiple CSVs manually yourself.
Prerequisites: What You’ll Need to Get Started
The process is straightforward, but you need a few things in place first. Make sure you have the following before you begin:
- Administrator access to your Google Analytics 4 property.
- A Google Cloud Platform (GCP) project with at least Editor or Owner level permissions. Don't worry, if you don't have a Google Cloud Platform account, creating a project is free and only takes a couple of minutes.
- Billing enabled for your Google Cloud project. The GA4 export itself is free for most users, leveraging the free tier. BigQuery storage and querying also have a very generous free tier (10 GB of storage and 1 TB of queries per month), but a billing account must be linked to your project. Standard accounts can use the free tier sandbox, however, GA4 and Google accounts require billing for some actions.
Step-by-Step Guide: How to Link GA4 and BigQuery
Once you have the prerequisites handled, the actual linking process only takes a few clicks. Follow these steps carefully.
Step 1: Navigate to the Admin Panel in GA4
Log in to your Google Analytics account and navigate to the GA4 property you want to connect. In the bottom-left corner, click the gear icon for Admin.
Step 2: Find the BigQuery Links Option
In the Property column, scroll down until you see the "Product Links" section. Click on BigQuery Links.
Step 3: Create a New Link
If you haven't connected any projects before, this screen will be empty. Click the blue Link button in the top right to start the setup process.
Step 4: Choose Your BigQuery Project
Next, click Choose a BigQuery project. A list of all the Google Cloud projects your email has access to will appear. Select the project you prepared earlier and click Confirm.
Step 5: Configure Your Data Settings
This is the most important step in the configuration process.
- Data location: Choose the geographical location where you want your data to be stored. It's best practice to pick the location closest to you physically. Once this is set, it cannot be changed.
- Data streams & events: Select the data stream(s) you want to export. For most websites, you'll just have one stream. You also have the option here to exclude certain events if you don't need them in your export, which can help save a little on storage costs.
- Frequency: You have two export options:
For most users, starting with the Daily export is perfectly fine and stays within the free tier. You can edit the link later to enable streaming if needed.
Step 6: Review and Submit
Finally, review your settings on the last screen. If everything looks correct, click Submit. That's it! Your GA4 property is now linked to BigQuery.
What to Expect After Connecting: Your Data in BigQuery
Linking is instant, but your data won't appear immediately. The first daily export will run within 24 hours. After that, by navigating to your project in the Google Cloud Console, you will see a new dataset named analytics_<property_id>.
Inside this dataset, you’ll find tables named events_YYYYMMDD. Each table contains all the event data for that specific day. If you enabled the streaming export, you’ll also see a table named events_intraday_YYYYMMDD, which holds data for the current day in near real-time.
**Heads Up: Nested Data!** One crucial thing to understand about the GA4 schema in BigQuery is that it's *nested.* This means some columns, like `event_params`, don't just hold a single value — they hold an entire table of key-value pairs inside them. Querying this data requires a special function called `UNNEST()`, which effectively unpacks these nested fields so you can work with them.
Quick Start: Running Your First Queries on GA4 Data
To access your data, you'll need to write queries in SQL (Structured Query Language). If you’re new to SQL, it can seem intimidating, but you can start pulling valuable insights with just a few basic commands.
Example 1: Counting Daily Total Users
This simple query counts the total number of unique users who visited your site on a specific day.
SELECT
COUNT(DISTINCT user_pseudo_id) AS total_users
FROM
`your_project_name.analytics_12345678.events_20231026`Just replace your_project_name, the analytics property ID, and the date with your own values.
Example 2: Finding Your Top 10 Most Viewed Pages
This query is slightly more complex as it uses UNNEST to look inside the event_params field to find the page location for each page_view event.
SELECT
(SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'page_location') AS page,
COUNT(*) AS pageviews
FROM
`your_project_name.analytics_12345678.events_*`
WHERE
event_name = 'page_view'
AND
_TABLE_SUFFIX BETWEEN '20231001' AND '20231026'
GROUP BY
page
ORDER BY
pageviews DESC
LIMIT 10This query shows the power of being able to dig into the exact parameters of each event, unlocking insights hidden within your data directly in your own SQL console. Simple report customization of this type is not possible in GA4 from a C-level interface.
Final Thoughts
Connecting GA4 to BigQuery is one of the most powerful steps you can take to level up your analytics. You gain access to raw, unsampled data without retention limits, empowering you to build detailed user segmentation, custom analysis, and advanced reports, performing in-depth analysis that simply isn't possible through the standard reporting UI.
As powerful as this connection is, it introduces a new skill requirement: wrangling data in BigQuery with SQL. The learning curve for SQL and database management can be steep for marketers and business owners who need answers now, not after an 80-hour analytics course. For that particular purpose, we built Graphed to do two things for you and your company: Graphed connects to Google Analytics and your other marketing or sales data in seconds and automates data analysis with AI assistance via chat on your data to generate full reports by just describing them in plain human words, avoiding the need for custom code or long hours of learning for simple tasks.
Related Articles
What SEO Tools Work with Google Analytics?
Discover which SEO tools integrate seamlessly with Google Analytics to provide a comprehensive view of your site's performance. Optimize your SEO strategy now!
Looker Studio vs Metabase: Which BI Tool Actually Fits Your Team?
Looker Studio and Metabase both help you turn raw data into dashboards, but they take completely different approaches. This guide breaks down where each tool fits, what they are good at, and which one matches your actual workflow.
How to Create a Photo Album in Meta Business Suite
How to create a photo album in Meta Business Suite — step-by-step guide to organizing Facebook and Instagram photos into albums for your business page.