BigQuery Integration with GA4 and Pack

BigQuery gives you raw, event-level GA4 data — enabling custom SQL queries, joins with first-party data, and long-term retention beyond GA4's data limits. This is the recommended reporting path for stores that need more analytical flexibility than GA4 Explore provides.

Prerequisites: A Google Cloud Platform (GCP) account with billing enabled, and a GA4 property already collecting data.

The setup has three parts:

  1. Set up a GCP project and service account
  2. Link GA4 to BigQuery
  3. Connect BigQuery to Pack

1. GCP Setup

Create or select a GCP project

  1. Go to the GCP Console
  2. Create a new project or select an existing one from the project selector in the top navigation
  3. If creating new: enter a Project Name, optionally edit the Project ID (this cannot be changed later), then click Create

Note the Project ID — you will need it when configuring the Pack integration.

Enable the BigQuery API

  1. Go to the BigQuery API page in the API Library
  2. Confirm the correct project is selected in the top navigation
  3. Click Enable

Create a service account

Pack uses a service account with read-only access to query your BigQuery data.

  1. Go to IAM & Admin → Service Accounts
  2. Confirm the correct project is selected
  3. Click Create Service Account and give it a name (e.g. pack-bigquery-access)
  4. Click Create and continue
  5. Assign the following two roles:
    • BigQuery Job User — allows the account to run queries
    • BigQuery Data Viewer — allows the account to read dataset contents
  6. Click Continue, then Done

Generate a JSON key

  1. In the Service Accounts list, click the service account you just created
  2. Go to the Keys tab
  3. Click Add Key → Create new key
  4. Select JSON and click Create

A .json file will be downloaded. Keep this file — you will need its contents in Step 3.

The downloaded key will look like this:

{
  "type": "service_account",
  "project_id": "your-gcp-project-id",
  "private_key_id": "...",
  "private_key": "-----BEGIN RSA PRIVATE KEY-----\n...",
  "client_email": "pack-bigquery-access@your-gcp-project-id.iam.gserviceaccount.com",
  "client_id": "...",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/pack-bigquery-access%40your-gcp-project-id.iam.gserviceaccount.com",
  "universe_domain": "googleapis.com"
}

This step configures GA4 to export event data to your BigQuery dataset daily.

  1. Open your GA4 property and go to Admin
  2. Under Product links, click BigQuery links
  3. Click Link
  4. Click Choose a BigQuery project and select the project you created in Step 1
  5. Click Confirm
  6. Select your preferred data location and click Next
  7. Under Event data, enable Include advertising identifiers for mobile app streams and set Export frequency to Daily
  8. Under User data, set Export frequency to Daily
  9. Click Next, review the configuration, then click Submit

GA4 will now export event data to BigQuery once per day. The dataset will appear in BigQuery under your project with the name analytics_<GA4_PROPERTY_ID>.

Note: The first export runs the following day. No data is backfilled for dates before the link was created.


3. Connect BigQuery to Pack

Once GA4 is exporting to BigQuery, connect it to Pack so experiment data can be queried from the Pack admin.

  1. In the Pack admin, go to Store → Settings → Integrations
  2. Click New Integration and select BigQuery
  3. Fill in the following fields:
FieldValue
GCP Project IDYour project ID (visible at console.cloud.google.com/welcome)
Dataset Nameanalytics_<GA4_PROPERTY_ID> (visible in BigQuery under your project)
Service Account JSONPaste the full contents of the JSON key file downloaded in Step 1
  1. Click Save

Pack will use the service account credentials to query your BigQuery dataset for experiment analytics.


What data is available

Once connected, BigQuery contains the full GA4 event stream including all view_experiment exposure events pushed by Pack's data layer. You can query these directly with SQL — for example, to join experiment exposure with purchase events or calculate conversion rates per variant across any time range.

For the GTM setup that feeds this data, see the GTM & GA4 Integration guide.

Was this page helpful?