UNAmedia Docs

Documentation & Knowledge Base

User Tools

Site Tools


ue5-google-analytics:ga4-bigquery

Connect GA4 to BigQuery

If you want to run enhanced custom analysis on the data you logged on GA4, you can easily connect your GA4 property to a Google BigQuery project to have access to all the logged data and run custom complex queries on them.

Google offers a free BigQuery sandbox that you can use for free to start working on your data. Read Enable the BigQuery sandbox to enable it.

Quick configuration

Note from Google documentation:

Analytics will update daily tables for up to 72 hours beyond the date of the table with events that are timestamped with the date of the table

So, after the initial setup, usually you have to wait before seeing some data available in BigQuery.

Helpful links to official documentation:

Sample queries

Once your data are available in your BigQuery project, you can easily run some simple queries on them.

Dump the latest events, ordered by timestamp:

SELECT
  STRING(TIMESTAMP_MICROS(event_timestamp)) AS TS,
  *
FROM `<bigquery_project>.<snapshot_dataset>.<events_table>`
ORDER BY event_timestamp
LIMIT 1000;

Dump the latest events, ordered by timestamp and batch index:

SELECT
  STRING(TIMESTAMP_MICROS(event_timestamp)) AS TS,
  *
FROM `ue4-ga4-test.analytics_270803549.events_20240411`
ORDER BY
  event_timestamp,
  (SELECT VALUE.int_value FROM UNNEST(event_params) WHERE KEY = 'batch_ordering_id')
LIMIT 1000

In case of issues, check the logs at https://console.cloud.google.com/logs.

ue5-google-analytics/ga4-bigquery.txt · Last modified: 2024/05/12 14:10 by Staff