GA4 BigQuery Query Generator — Free SQL Generator | Adslytics | Adslytics

🗄️

GA4 BigQuery Query Generator

Generate BigQuery SQL for your GA4 data

How It Works

1

Select your event and dimensions

Choose the GA4 event name and the dimensions you want to analyse.

2

Set date range and project details

Enter your GA4 BigQuery project/dataset and select the date range for your query.

3

Copy the SQL

Get ready-to-run BigQuery standard SQL that queries the correct GA4 table schema.

GA4 BigQuery Query Generator


              
            

Why GA4 Analysts Use BigQuery Instead of the GA4 UI

The GA4 UI is designed for marketers who need quick insights from pre-aggregated reports. But when you need to answer questions like "what is the exact sequence of events that leads to purchase?", the GA4 UI hits its limit. BigQuery gives you direct access to every individual event, every parameter value, and every user session — at the raw row level — with the full power of standard SQL. This GA4 BigQuery query generator produces syntactically correct BigQuery SQL handling the notoriously tricky UNNEST(event_params) syntax automatically.

Understanding the GA4 BigQuery Schema

  • One row = one event. Every event fired by every user gets its own row. Events are not pre-aggregated — you count, sum, and group them yourself in SQL.
  • event_params is a REPEATED RECORD. Each event can have many parameters, stored as an array of key-value structs. Use UNNEST(event_params) to flatten it.
  • Values are typed. Each parameter value has four sub-fields: value.string_value, value.int_value, value.float_value, value.double_value.
  • Wildcard tables for date ranges. Query multiple days with events_* and WHERE _TABLE_SUFFIX BETWEEN '20240101' AND '20240131'.

Frequently Asked Questions

GA4 can export raw event data to BigQuery — one table per day in the format "events_YYYYMMDD". This gives you access to every individual event and parameter for custom analysis.
Each row is a single event. Key columns: event_name, event_timestamp, user_pseudo_id, event_params (REPEATED RECORD), user_properties, device, geo, and traffic_source.
Use UNNEST(event_params) to flatten the repeated record, then filter by key.value = "param_name" and access the value via value.string_value or value.int_value.
Yes — use a wildcard table: SELECT * FROM `project.dataset.events_*` WHERE _TABLE_SUFFIX BETWEEN "20240101" AND "20240131".
The BigQuery export itself is free. BigQuery charges for query processing (first 1TB/month free) and storage (first 10GB/month free).