Request a demo

GA4 in BigQuery

GA4 BigQuery export: the SQL cookbook

Ready-to-run queries for the Google Analytics 4 export, from unnesting event_params to sessions, attribution, funnels and cohorts. Each one runs on Google's public GA4 sample, shows what it scans, and how to scan less as your own export grows.

Working with the export

How the GA4 export is laid out, and how to query it without scanning everything.

Users, sessions and traffic

Users, sessions, page views and where visitors come from.

Engagement and events

Engagement time, engaged sessions, events and their parameters.

Ecommerce and conversions

Purchases, revenue, items and funnels.

Retention and cohorts

Who comes back, and when.

Cost and performance

Keep GA4 queries cheap as the export grows.

Cut BigQuery spend without guessing

Masthead attributes compute and storage cost to every project, user, pipeline and table, finds unused and dead-end tables, and shows where editions or on-demand pricing is cheaper. Mnemonic cut its BigQuery compute cost by 20% within 24 hours of onboarding.