Connect Google Analytics 4 to Ocular through the GA4 BigQuery export using a Google Cloud service account for full session and event-level reporting.
Ocular reads GA4 data through the GA4 → BigQuery export. You’ll link GA4 to a BigQuery project, create a service account with read access, grant that service account access to the GA4 property, then paste the credentials into Ocular.
Storefront-attributed ROAS, the User Activity Cohort (event-based retention), and the full session-to-checkout funnel.
Prerequisites: a GA4 property, a Google Cloud project with billing or sandbox enabled, BigQuery Owner on that project, and at least GA4 Editor access on the property.
Skip this step if you already have GA4 exporting to BigQuery.
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.
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.
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.
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.
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.
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.
When you link GA4 to BigQuery, Google creates a service account firebase-measurement@system.gserviceaccount.com. Verify it’s been added as a project member with the BigQuery User role. If it was given Editor previously, you’ll need to unlink and relink GA4 to BigQuery to change the role.
When data starts flowing, GA4 writes events_* tables into a dataset named analytics_PROPERTY_ID inside the selected project.
Step 2 · Create a service account with BigQuery access
Open IAM & Admin → Service Accounts
In Google Cloud console, open the same project and navigate to IAM & Admin → Service Accounts.
Open IAM & Admin → Service AccountsOpen IAM & Admin → Service Accounts
In Google Cloud console, open the same project and navigate to IAM & Admin → Service AccountsIn Google Cloud console, open the same project and navigate to IAM & Admin → Service Accounts.
Create the service accountCreate the service account
Click + Create Service Account, name it (e.g., ocular-ga4-reader), and click Create and Continue.Click + Create Service Account, name it (e.g., ocular-ga4-reader), and click Create and Continue.
Create the service account
Click + Create Service Account, name it (e.g., ocular-ga4-reader), and click Create and Continue.
Grant roles
Add these three 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.
Grant roles
Add these three 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.
Create a JSON key
Click Done, open the service account, then Keys → Add key → Create new key → JSON. Save the file securely — it contains the service-account key Ocular will use.
Create the service account
Click + Create Service Account, name it (e.g., ocular-ga4-reader), and click Create and Continue.
Grant roles
Add these three 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.
Grant roles
Add these three 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.
Create a JSON key
Click Done, open the service account, then Keys → Add key → Create new key → JSON. Save the file securely — it contains the service-account key Ocular will use.
Create a JSON key
Click Done, open the service account, then Keys → Add key → Create new key → JSON. Save the file securely — it contains the service-account key Ocular will use.
In Ocular, open Data Management → Connectors → Add connector → Google Analytics 4.
Open the connector form
In Ocular, open Data Management → Connectors → Add connector → Google Analytics 4.
Fill the fields
Connector Name
Any name you choose.
Project ID
Your Google Cloud project ID.
Service-account JSON key
Upload or paste the JSON file contents from Step 2.
Schema name
The analytics_* dataset name from Step 4.
Start Date
Earliest date for data sync (e.g., 2023-01-01).
Location of the BigQuery
The region from Step 4.
Open the connector form
In Ocular, open Data Management → Connectors → Add connector → Google Analytics 4.
Fill the fields
Connector Name
Any name you choose.
Project ID
Your Google Cloud project ID.
Service-account JSON key
Upload or paste the JSON file contents from Step 2.
Schema name
The analytics_* dataset name from Step 4.
Start Date
Earliest date for data sync (e.g., 2023-01-01).
Location of the BigQuery
The region from Step 4.
Fill the fields
Connector Name
Any name you choose.
Start DateStart Date
Earliest date for data sync (e.g., 2023-01-01)Earliest date for data sync (e.g., 2023-01-01).
Lookback DaysLookback Days
Number of past days re-fetched on each sync so late-updating data stays current. Default is 30 daysNumber of past days re-fetched on each sync so late-updating data stays current. Default is 30 days.
Events Start DatEvents Start Date
The date from which you want to start loading events datadate from which you want to start loading events data.
UTM Attribution LevelUTM Attribution Level
Choose Campaign if your UTMs are defined at the campaign level, or Ad if they’re defined at the ad level — attribution is applied at the level you pickChoose Campaign if your UTMs are defined at the campaign level, or Ad if they’re defined at the ad level — attribution is applied at the level you pick.
Schema name
The analytics_* dataset name from Step 4.
Service-account JSON key
Upload or paste the JSON file contents from Step 2.
Project ID
Automatically extracted from your service-account JSON file.
GA4 Property ID
Your GA4 Property ID — see Step 4 for where to find it.
Schema name
The analytics_* dataset name from Step 4.
Service-account JSON key
Upload or paste the JSON file contents from Step 2.
Project ID
Automatically extracted from your service-account JSON file.
GA4 Property ID
Your GA4 Property ID — see Step 4 for where to find it.
Location of the BigQuery
The region from Step 4.
Create the connection
Click Create Connection. Ocular validates the key by running SELECT COUNT(1) FROM .analytics_* LIMIT 1.On success, click Create — the first daily sync kicks off automatically.
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.
Connection succeeds but Ocular sees no rows
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.
Permission denied on BigQuery
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.
Need to change the region after linking
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.
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 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.
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.