Skip to main content
Ocular reads GA4 data through the GA4 → BigQuery export. You’ll create a service account with read access, grant that service account access to the GA4 property, link GA4 to a BigQuery project, then paste the credentials into Ocular.

Required fields in Ocular

  • Project ID — your Google Cloud project that hosts the GA4 → BigQuery export
  • Service-Account Key (JSON) — the contents of a JSON key file for a service account that can read BigQuery and view the GA4 property
  • Schema name — the schema name in which your BigQuery export happens
  • Start Date & Event Start Date — the date after which you want your data to be fetched and used by Ocular
  • GA4 Property ID — located under company name
  • Location of the BigQuery — the location of the schema in the BigQuery you specified
Follow the five sections below, then paste the values into Data Management → Connectors → Add connector → Google Analytics 4.
What it unlocks: storefront-attributed ROAS, the User Activity Cohort (event-based retention), and the full session-to-checkout funnel.
GA4 connector placeholderGA4 connector placeholder

GA4 connector — Data Management → Connectors → Add connector → Google Analytics 4


Step 1 · Create a service account with BigQuery access

Skip this step if you already have one.

Open IAM & Admin → Service Accounts

In Google Cloud console, open the same project and navigate to IAM & Admin → Service Accounts.
IAM & Admin → Service AccountsIAM & Admin → Service Accounts

IAM & Admin → Service Accounts

Click + Create Service Account

Name it and click Create and Continue

Name it (e.g., ocular-ga4-reader) and click Create and Continue.
Service account detailsService account details

Service account details — name the account and click Create and Continue

Grant roles

Grant these roles:

BigQuery Data Viewer

Read dataset and table data.

BigQuery Job User

Run BigQuery jobs in the project.

BigQuery Read Session User

For faster large-table reads.
Grant the three BigQuery rolesGrant the three BigQuery roles

Grant this service account access to project — use Add another role for each

Create a JSON key

Click Done, then go back into the service account and choose Keys → Add key → Create new key → JSON.
Service accounts listService accounts list

Open the service account from the Service accounts list

Keys tab → Add key → Create new keyKeys tab → Add key → Create new key

Keys tab → Add key → Create new key

Create private key — JSONCreate private key — JSON

Create private key — choose JSON and click Create

Save the key file

Save the file — it contains your service-account key.
If you are not sure how to create a service account with BigQuery access, you can follow the Google Cloud Service Account documentation.

Step 2 · Give the service account access to the GA4 property

Skip this step if you already have it.

Copy the service account email

Copy the service account’s email address.

Open GA4 Property Access Management

In GA4 Admin → Property Access Management, click + → Add users.

Assign the Viewer role

Paste the email and assign Viewer (read-only).

Save

Click Save.
The service account can now query GA4 event tables via BigQuery without using OAuth.
Skip this step if you already have GA4 exporting to BigQuery.
To proceed with the BigQuery linking you need: a GA4 property, a Google Cloud account, BigQuery Owner, and at least GA Editor permissions.

Open BigQuery Linking

In your GA4 property, click Admin and then BigQuery Linking.
GA4 AdminGA4 Admin

GA4 Home — open Admin

Create a new link

Click Link to create a new connection.
BigQuery links in GA4 AdminBigQuery links in GA4 Admin

Product links → BigQuery links

Choose your BigQuery project

Click Choose a BigQuery project. Select your existing BigQuery (Google Cloud) project and click Confirm.
If your project is not listed, make sure you’ve added it in Google Cloud and refresh this page.
Select your BigQuery projectSelect your BigQuery project

BigQuery links — click Link and select your project

Select your data location

Select your preferred data location. Make sure you choose the location where you run your queries.
If you choose the wrong region and need to change it after you’ve created the link, you’ll have to move the dataset in Google Cloud and then create a new link, or delete the link and dataset and start over.

Select the export frequency

Select the desired frequency of the data export:
  • Daily — for once a day updates.
  • Optional Streaming — adds a table where data from today is stored until the day is complete, then a new daily table is added.
Export type — Daily and StreamingExport type — Daily and Streaming

Event data and Export type — choose Daily and optionally Streaming

Optional — add another data stream

If you have another data stream (app or web), you can add it to the same BigQuery dataset via Edit.
The Streaming option is not available for BigQuery sandbox environments. You can enable streaming export later if you upgrade to a billing-enabled account.

Optional — filter events

You may see an additional step where you can filter events that will be sent to BigQuery. This is useful for events you don’t need or to avoid exceeding the daily limit of 1 million events.

Submit

Review the settings and if everything is correct, click Submit. The BigQuery link is created. It will take some time (up to 24 hours) for your data to appear in BigQuery.
When you link GA and BigQuery, a service account is created: firebase-measurement@system.gserviceaccount.com. Verify that this account has been added as a member of the project and given the role of BigQuery User. If you previously gave the service account the Editor role, you’ll need to unlink and relink GA to your BigQuery project to change the role.
When the data starts flowing in, GA4 will start writing tables like events_* in a dataset named analytics_PROPERTY_ID within your selected project. You should be able to query these tables and see results.

Step 4 · Find your BigQuery schema name and location

Finding the schema name

Open BigQuery

In Google Cloud Console, navigate to BigQuery.

Expand your project

In the Explorer panel, expand your Project ID.

Find the analytics_ dataset

Look for datasets starting with analytics_ followed by your GA4 property ID. The schema name is the complete dataset name — e.g., analytics_123456789.
analytics_* dataset in BigQuery Exploreranalytics_* dataset in BigQuery Explorer

The analytics_* dataset in the BigQuery Explorer

Finding the Property ID

Open your account

Click on your account name.

Read the Property ID

It’s located under Properties & Apps.
Property ID under Properties & AppsProperty ID under Properties & Apps

Property ID listed under Properties & Apps

Finding the BigQuery location

Click the dataset

Click on your analytics_* dataset in the BigQuery Explorer.

Read Data location

In the Dataset info panel on the right, look for Data location.

Note the region

Note the region (e.g., US, EU, asia-southeast1, etc.).
Data location in the completed link detailsData location in the completed link details

Default location for dataset creation in the completed link details

Alternatively, you can run this query in BigQuery to get both values:

Step 5 · Plug the credentials into Ocular

Open the connector form

Return to Data Management → Connectors → Add connector → Google Analytics 4.

Enter your values

Connector Name

Any name you choose.

Start Date

The earliest date for data sync (e.g., 2023-01-01).

Lookback Days

The number of past days from which data will be fetched during synchronization. This ensures recent historical data is included and kept up to date. The default setting is 30 days.

Events Start Date *

Select the date from which you want to start loading events data.

UTM Attribution Level

Choose campaign-level if UTMs are defined at the campaign level — attribution is applied at the campaign level. Choose ad-level if UTMs are defined at the ad level — attribution is applied at the individual ad level.

Schema name

The analytics_* dataset name from Step 4.

Service-account JSON key

Upload or paste the JSON file contents from Step 1.

Project ID

Your Google Cloud project ID. Automatically extracted from your service account JSON file.

GA4 Property ID

Located under company name — see Step 4 for the exact location.

Location of the BigQuery

The region from Step 4.
GA4 connector formGA4 connector form

GA4 connector form in Ocular

Create the connector

On success, click Create — your first daily sync kicks off automatically.

Troubleshooting

GA4 → BigQuery takes up to 24 hours for the first export. If nothing appears after 24 hours, verify:
  • The link is still active in GA4 Admin → BigQuery Linking.
  • firebase-measurement@system.gserviceaccount.com is a project member with the BigQuery User role.
  • You haven’t hit the 1-million-events daily cap on a sandbox project.
Confirm the Schema name matches the actual dataset (analytics_<property_id>, not just analytics_) and the Location matches the dataset’s region. A region mismatch causes BigQuery to silently return zero rows.
The service account must have all three roles: BigQuery Data Viewer, BigQuery Job User, BigQuery Read Session User. Re-check under IAM & Admin → IAM in Google Cloud and re-grant if any are missing.
BigQuery datasets can’t be moved across regions in place. Either move the dataset using Google Cloud’s transfer service, or unlink GA4 → BigQuery, delete the existing dataset, and re-link with the correct region.
For ticket-writing format when filing a connector issue, see Working with the Ocular team → Connector-not-working tickets.

GA4 Historical Connector

The GA4 Historical connector lets you import historical Google Analytics 4 data through the Google Analytics Reporting API — without needing a BigQuery export pipeline. Unlike the standard GA4 connector above, this one pulls pre-aggregated report data directly from the GA4 API. This is particularly useful when you need to:
  • Analyze data from before your GA4–BigQuery integration was set up
  • Access aggregated metrics and dimensions that may be pre-processed by Google
  • Backfill historical data for specific time periods
  • Pull historical reporting data without setting up the full BigQuery export pipeline

What you need

GA4 Property ID, Google Cloud Project ID, Service Account JSON key, and a Project Location.

What it unlocks

Pre-aggregated GA4 reporting data for historical periods not covered by your BigQuery export.
Prerequisites: A GA4 property with historical data, a Google Cloud project with the Google Analytics Reporting API enabled, and a service account with Viewer role on the GA4 property.

Step H1 · Locate your GA4 Property ID

Open BigQuery Linking

In your GA4 property, click Admin → BigQuery Linking.

Open BigQuery LinkingOpen BigQuery Linking

In your GA4 property, click Admin → BigQuery LinkingIn your GA4 property, click Admin → BigQuery Linking.
GA41GA41

GA4 Admin → BigQuery Linking

Create a new linkreate a new link

Click Link to start a new connectionLink to start a new connection.

Create a new linkCreate a new link

Click Link to start a new connectionClick Link to start a new connection.
GA42GA42

Click Link to create a new connection

Choose your Google Cloud project

Click Choose a BigQuery project, select your existing project, and click Confirm.
If your project isn’t listed, confirm you’ve created it in Google Cloud and refresh.

Choose your Google Cloud project

Click Choose a BigQuery project, select your existing project, and click Confirm.
If your project isn’t listed, confirm you’ve created it in Google Cloud and refresh.
GA43GA43

Select your BigQuery (Google Cloud) project and confirm

Pick a data location

Select the region where you’ll run your queries.
If you choose the wrong region and need to change it later, you’ll have to move the dataset in Google Cloud and create a new link, or delete the link + dataset and start over.

Choose export frequency

  • Daily — one update per day (recommended).
  • Streaming (optional) — a same-day table that fills until the day completes, then a new daily table is added.
Streaming is not available on BigQuery sandbox accounts. Enable it later if you upgrade to a billing-enabled project.

Choose your Google Cloud project

Click Choose a BigQuery project, select your existing project, and click Confirm.
If your project isn’t listed, confirm you’ve created it in Google Cloud and refresh.

Choose your Google Cloud project

Click Choose a BigQuery project, select your existing project, and click Confirm.
If your project isn’t listed, confirm you’ve created it in Google Cloud and refresh.
GA43GA43

Select your BigQuery (Google Cloud) project and confirm

Pick a data location

Select the region where you’ll run your queries.
If you choose the wrong region and need to change it later, you’ll have to move the dataset in Google Cloud and create a new link, or delete the link + dataset and start over.

Choose export frequency

  • Daily — one update per day (recommended).
  • Streaming (optional) — a same-day table that fills until the day completes, then a new daily table is added.
Streaming is not available on BigQuery sandbox accounts. Enable it later if you upgrade to a billing-enabled project.

Choose export frequency

  • Daily — one update per day (recommended).
  • Streaming (optional) — a same-day table that fills until the day completes, then a new daily table is added.
Streaming is not available on BigQuery sandbox accounts. Enable it later if you upgrade to a billing-enabled project.
GA44GA44

Choose your data location and export frequency

GA44GA44

Choose your data location and export frequency

Optional — add another stream or event filter

If you have an additional data stream (app or web), add it to the same dataset via Edit. You may also see a step to filter events sent to BigQuery — useful to skip events you don’t need or stay under the 1-million-events daily limit.

Submit

Review the settings and click Submit. The BigQuery link is created — first data takes up to 24 hours to appear in BigQuery.

Open your GA4 property

Go to your GA4 property in the Google Analytics interface.

Find the Property ID

The Property ID can be found in your GA4 property settings or in the URL of your GA4 property. It’s a numeric value (e.g., 123456789).
If you’re not sure where to find it, check the URL when viewing your GA4 property — it will contain the Property ID.

Step H2 · Create a service account with appropriate permissions

Open IAM & Admin → Service Accounts

In Google Cloud console, open your project and navigate to IAM & Admin → Service Accounts.

Create the service account

Click + Create Service Account, name it (e.g., ocular-ga4-reader), and click Create and Continue.

Grant roles

Add these roles:

BigQuery Data Viewer

Read dataset and table data.

BigQuery Job User

Run BigQuery jobs in the project.

BigQuery Read Session User

Faster reads on large tables.

Google Analytics Admin

Access the GA4 Reporting API.

Create a JSON key

Click Done, open the service account, then Keys → Add key → Create new key → JSON. Save the file securely.

Add service account to GA4

Copy the service account email address. In GA4, go to Admin → Property Access Management, click + → Add users, paste the email, assign the Viewer role, and click Save.
If you are not sure how to create a service account, follow the Google Cloud Service Account documentation.

Step H3 · Set up the connector in Ocular

Open the connector form

In Ocular, navigate to Data Management → Connectors → Add connector → GA4 Historical.

Fill the fields

Connector Name

A descriptive name for your connector (e.g., GA4 Historical Main).

Start Date (optional)

The date from which you want to start loading data. Leave empty to use the default configuration.

GA4 Property ID

Your Google Analytics 4 Property ID (e.g., 123456789).

Project Location

The geographic location where your Google Cloud project is located (e.g., Asia South 1 (Mumbai)).

Service Account JSON

Upload your JSON key file or paste its contents. The Google Cloud Project ID is automatically extracted from this file.

Step H4 · Test and create the connection

Test the connection

Click Test Connection to verify your credentials and API access.

Create the connector

Once successful, click Update Connector to create the connection and begin retrieving historical GA4 data.
Unlike the standard GA4 connector that pulls raw event data from BigQuery, the Historical connector uses the Google Analytics Reporting API to retrieve pre-aggregated data. This means it may have different metrics and dimensions available than what you’d find in the raw BigQuery export.