> ## Documentation Index
> Fetch the complete documentation index at: https://fromhazel.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# GA4 BigQuery Export: Raw GA4 Event Data

> Connect your GA4 BigQuery export so Hazel can read every GA4 event, unsampled, with its parameters and ecommerce items.

## Overview

The GA4 BigQuery export gives Hazel your raw Google Analytics events, one row per event. Use it for questions the standard [Google Analytics](https://fromhazel.ai/docs/integrations/google-analytics.md) integration can't answer, like where shoppers drop off between viewing a product and checking out.

| | [Google Analytics](https://fromhazel.ai/docs/integrations/google-analytics.md) | GA4 BigQuery Export |
| - | - | - |
| Data | Report totals (sessions, channels, landing pages) | Every event, unsampled |
| Setup | Sign in with Google | Link GA4 to BigQuery, then give Hazel a service account |
| History | Back to your property's start | From the day you turn on the export |

## What Hazel pulls

Hazel reads the daily events tables (`events_YYYYMMDD`) in your GA4 dataset. Each row is one event, such as a page view, add to cart, purchase, or custom event, with its parameters, ecommerce items, device, geography, traffic source, and pseudonymous user and session IDs.

## How to connect

There are two parts. First you send your GA4 data to BigQuery, then you give Hazel access to read it.

**What you'll need:**

* Editor or Administrator access to your GA4 property
* A Google Cloud project where you can create service accounts and grant roles

### Part 1: Send your GA4 data to BigQuery

Already exporting GA4 to BigQuery? Skip to Part 2.

**1. Open BigQuery links in Google Analytics**

In [Google Analytics](https://analytics.google.com/), click **Admin** at the bottom of the left sidebar. Under **Product links**, choose **BigQuery links**, then click **Link**.

![Google Analytics Admin page with BigQuery links highlighted under Product links](https://mintcdn.com/hazel-1bd6927f/J3xFGu6k6xlp7nOK/images/integrations/ga4-bigquery-export/bigquery-links.png?fit=max\&auto=format\&n=J3xFGu6k6xlp7nOK\&q=85\&s=d6dea08f13fa91bfef02c13e4bfb5279)

**2. Choose your project and turn on daily exports**

Pick your Google Cloud project and a data location. If you don't have a project, create one first from the project picker in the [Google Cloud console](https://console.cloud.google.com/).

Set the export type to **Daily** for both **Event data** and **User data**. Leave **Streaming** unchecked.

![BigQuery link settings with Daily selected for both Event data and User data](https://mintcdn.com/hazel-1bd6927f/J3xFGu6k6xlp7nOK/images/integrations/ga4-bigquery-export/export-settings.png?fit=max\&auto=format\&n=J3xFGu6k6xlp7nOK\&q=85\&s=3fe4703b2fd4960a9101edf5bc69d27c)

Submit the link. Google creates a dataset named `analytics_<property_id>` in your project, and the first day of data arrives within about 24 hours. Google's guide to [setting up BigQuery Export](https://support.google.com/analytics/answer/9823238) has more detail.

### Part 2: Give Hazel access

Hazel reads your export as a service account, which is a Google login for software. You create it in your project, let it read only your GA4 dataset, and enter its key in Hazel.

**1. Create a service account and key**

In the Google Cloud console, open [Service Accounts](https://console.cloud.google.com/iam-admin/serviceaccounts) in the project that holds your GA4 dataset, and click **Create service account**. Name it something like `hazel-ga4-reader` and copy its email address, which you'll need to share the dataset. Click **Create and continue**, not **Create and close**, so you reach the Permissions step.

![Create service account form with the email address and Create and continue highlighted](https://mintcdn.com/hazel-1bd6927f/J3xFGu6k6xlp7nOK/images/integrations/ga4-bigquery-export/create-service-account.png?fit=max\&auto=format\&n=J3xFGu6k6xlp7nOK\&q=85\&s=4386014d5558fab5afb14b2610254f7d)

Under **Permissions**, choose the **BigQuery Read Session User** role, then click **Done**. Hazel reads tables through the BigQuery Storage Read API, and this role lets it start those reads in your project. It doesn't give access to any data.

![Role picker with BigQuery Read Session User highlighted](https://mintcdn.com/hazel-1bd6927f/J3xFGu6k6xlp7nOK/images/integrations/ga4-bigquery-export/role-read-session-user.png?fit=max\&auto=format\&n=J3xFGu6k6xlp7nOK\&q=85\&s=ae1cc3991e12b67ba7e3de6a841f7237)

Open the new service account, go to the **Keys** tab, and click **Add key → Create new key**. Choose **JSON** and click **Create**. A key file downloads to your computer. You'll use it when you connect in Hazel. Google shows a warning about downloading keys; Hazel needs this key to connect, so go ahead.

![Service account Keys tab with Add key open and Create new key highlighted](https://mintcdn.com/hazel-1bd6927f/J3xFGu6k6xlp7nOK/images/integrations/ga4-bigquery-export/create-key.png?fit=max\&auto=format\&n=J3xFGu6k6xlp7nOK\&q=85\&s=05256d316270c015b6ec822c8c906391)

**2. Open your GA4 dataset's permissions**

In BigQuery, open your project's **Datasets** and click `analytics_<property_id>`. Click **Share**, then **Manage permissions**.

![BigQuery dataset page with Share open and Manage permissions highlighted](https://mintcdn.com/hazel-1bd6927f/J3xFGu6k6xlp7nOK/images/integrations/ga4-bigquery-export/share-manage-permissions.png?fit=max\&auto=format\&n=J3xFGu6k6xlp7nOK\&q=85\&s=a88411be3ffff77abd3939daf87a0177)

**3. Add the service account as a Data Viewer**

Click **Add principal**.

![Share permissions dialog with Add principal highlighted](https://mintcdn.com/hazel-1bd6927f/J3xFGu6k6xlp7nOK/images/integrations/ga4-bigquery-export/add-principal.png?fit=max\&auto=format\&n=J3xFGu6k6xlp7nOK\&q=85\&s=20c5e27d725ab71350393c3d20e6b4d8)

Paste the service account's email, choose the **BigQuery Data Viewer** role, and click **Save**. This grant covers the GA4 dataset only, not the rest of your project.

![Role search with BigQuery Data Viewer highlighted](https://mintcdn.com/hazel-1bd6927f/J3xFGu6k6xlp7nOK/images/integrations/ga4-bigquery-export/role-data-viewer.png?fit=max\&auto=format\&n=J3xFGu6k6xlp7nOK\&q=85\&s=f2cf0594a0bfcc5990e13351d19a9bb7)

**4. Connect in Hazel**

Find GA4 BigQuery Export in the [Hazel marketplace](https://app.fromhazel.ai/integrations/marketplace?search=bigquery) and click **+**. You'll copy two values from your key file:

```json theme={null}
{
  "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADAN...\n-----END PRIVATE KEY-----\n",
  "client_email": "hazel-ga4-reader@your-project.iam.gserviceaccount.com",
  ...
}
```

Fill in the form:

* **Service Account Email Address**: the `client_email` value
* **Scopes**: `https://www.googleapis.com/auth/cloud-platform`
* **Private Key**: the `private_key` value, everything between the quotes, including each `\n`

Leave **Delegated Access Email Address** empty. Once you've connected, delete the key file from your computer.

**5. Send us your dataset ID**

In BigQuery, find your project ID and dataset ID.

![BigQuery Datasets page with the project ID and dataset ID highlighted](https://mintcdn.com/hazel-1bd6927f/J3xFGu6k6xlp7nOK/images/integrations/ga4-bigquery-export/dataset-id.png?fit=max\&auto=format\&n=J3xFGu6k6xlp7nOK\&q=85\&s=55d157c5030ec4220880769d575bff6c)

Send them to your Hazel team in your shared Slack channel as `<project_id>.<dataset_id>`, for example `my-project.analytics_123456789`. Hazel starts syncing once we've added it to your connection.

## Example questions you can ask

* "Where do people drop off between product view, add to cart, and checkout this month?"
* "Which products get viewed a lot but rarely added to cart?"
* "What's the most common path from landing page to purchase?"
* "Do sessions that use site search convert better?"
* "Break down add to cart rate by device and browser"

## Good to know

* Google doesn't backfill the export, so Hazel's history starts the day you link it. Turn on the User data export now as well. Hazel doesn't read it yet, but its history can't be filled in later either.
* Google updates each day's table for up to three days as late events arrive, and sometimes reprocesses older days. Hazel rereads any day that changes.
* Standard GA4 properties can export up to 1 million events a day. Google emails your GA4 admins when a property goes over, and pauses the daily export if it keeps happening. Missed days aren't recovered. GA4 360 has a higher limit.
* Reads are billed to your Google Cloud project. Hazel reads each day's table once, and again only if Google changes it.
* If your organization blocks service account key creation, or your project sits inside VPC Service Controls, your cloud admin will need to make an exception for this service account.
* GA4's `user_pseudo_id` is a browser cookie, so it doesn't match Shopify customers unless you send your own user ID to GA4.

> [!TIP]
>
> **Ready to connect?** Head to the [Hazel marketplace](https://app.fromhazel.ai/integrations/marketplace) to get started. Need help? Reach out via your shared Slack channel or [contact support](https://fromhazel.ai/docs/resources/contact-support.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.