Docs / Google Analytics 4

Connect Google Analytics 4

Web and app analytics


climpt does not use the GA4 reporting API. It reads the raw event export in BigQuery, which is the same data without GA4’s sampling or interface limits. Two steps: link the property to BigQuery, then connect to the dataset.

Step 1 · Link GA4 to BigQuery

  1. In Google Analytics, select the GA4 property and open Admin.
  2. Under the Property column, click BigQuery Links Link.
  3. Choose the Google Cloud project to export into, or create one.
  4. Pick the data streams, the export frequency — daily or streaming — and the location.
  5. Submit, then wait. Streaming starts immediately; the first daily export lands after about 24 hours.
  6. Note the dataset name. It takes the form analytics_PROPERTY_ID.

What the export contains

events_YYYYMMDD
One table per day, finalised roughly 24 hours after the day ends.
events_intraday_YYYYMMDD
The streaming table, updated every few minutes. Streaming export requires a GA4 360 property; standard properties get the daily export only.

Both carry event parameters, user properties, device and geography, session data, conversions, ecommerce transactions, and every custom event you have configured.

Step 2 · A service account for the dataset

This is an ordinary BigQuery connection, so it uses the same three read-only roles — two at project level, one on the GA4 dataset.

roles/bigquery.jobUser
Project level. Lets climpt create a query job.
roles/bigquery.readSessionUser
Project level. Lets climpt read results through the Storage Read API. Without it, discovery succeeds and every query fails with a bigquery.readsessions.create error.
roles/bigquery.dataViewer
On the analytics dataset only — not the whole project.
  1. In the Google Cloud console, go to IAM & Admin → Service Accounts and create one named, say, ga4-bigquery-readonly.
  2. Grant it BigQuery Job User and BigQuery Read Session User at project level.
  3. Open BigQuery, find the dataset — something like analytics_123456789 — and use ⋮ → Share to grant BigQuery Data Viewer.
  4. Back in Service Accounts, create a JSON key from the Keys tab.
  5. In climpt, add a Google BigQuery connection and paste the whole JSON file.

Querying the export

Use _TABLE_SUFFIX to span days — it prunes the tables BigQuery reads, which is the difference between scanning a week and scanning your whole history.

Page views over the last seven days

SELECT
  event_date,
  COUNT(*) AS page_views,
  COUNT(DISTINCT user_pseudo_id) AS users
FROM `your-project.analytics_123456789.events_*`
WHERE event_name = 'page_view'
  AND _TABLE_SUFFIX BETWEEN
    FORMAT_DATE('%Y%m%d', DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY))
    AND FORMAT_DATE('%Y%m%d', CURRENT_DATE())
GROUP BY event_date
ORDER BY event_date DESC;

Conversions by event

SELECT
  event_name,
  COUNT(*) AS conversions,
  COUNT(DISTINCT user_pseudo_id) AS converting_users
FROM `your-project.analytics_123456789.events_*`
WHERE event_name IN ('purchase', 'sign_up', 'lead_form_submit')
  AND _TABLE_SUFFIX BETWEEN '20250101' AND '20250131'
GROUP BY event_name
ORDER BY conversions DESC;

Worth knowing

  • Event parameters are nested. Reach them with UNNEST(event_params).
  • BigQuery bills on data scanned, and GA4 exports get large quickly. Always filter on _TABLE_SUFFIX.
  • Views over the reports you run often are a cheap way to cut repeated cost.
  • Rotate the service account key roughly every 90 days.