UTM parameters in BigQuery
When GA4 is linked to BigQuery, campaign data arrives in the event export as nested event_params and traffic-source fields. The UTM-derived values — source, medium, campaign, content, term — are queryable with SQL via UNNEST, letting you build custom attribution beyond the GA4 UI. This page covers where UTM-derived fields live in the BigQuery schema and the basic query shape.
Where UTM-derived fields live
In the GA4 BigQuery export, traffic-source information appears in fields such as traffic_source and collected_traffic_source, and campaign details are also present in event_params for relevant events. The keys mirror the UTM mapping: source, medium, campaign, content, term.
Because event_params is a repeated record, you query a specific key with UNNEST and a filter on the key name.
- Session traffic-source fields hold source/medium/campaign
- event_params (repeated) holds per-event campaign keys
- UNNEST event_params to extract a specific key
A basic query shape
To pull campaign for an event, UNNEST event_params and select the value where key = 'campaign' (or the relevant key). Aggregate by source and medium for a custom acquisition report.
Watch for nulls: not every event carries every campaign key, so coalesce against the session traffic-source fields when building first-touch attribution.
How it appears in analytics and logs
In the BigQuery export, UTM-derived values appear in the session/traffic-source fields and event_params. A campaign missing from a query usually means the wrong key was UNNESTed or the value sits in collected_traffic_source rather than the event_params you queried.
Diagnostic use case
Query campaign attribution directly in BigQuery from the GA4 export, building custom source/medium/campaign reports or joins that the GA4 interface does not offer.
What WebmasterID can help detect
WebmasterID's server-side UTM capture can be exported and joined alongside a warehouse dataset, giving a campaign view that does not depend solely on the GA4 client export pipeline.
Common mistakes
- Forgetting event_params is repeated and querying it without UNNEST.
- Looking for campaign only in event_params and missing the traffic-source fields.
- Assuming every event row carries the UTM keys; many are null.
- Hard-coding key names that differ between GA4 export schema versions.
Privacy and accuracy notes
The BigQuery export contains campaign fields that describe links, not identities. Visitor-level fields are governed by your GA4 consent and export configuration; UTMs add no personal data beyond the campaign labels.
Related pages
- UTM in Google Analytics 4
Google Analytics 4 reads the standard utm_ query parameters and maps them to its session and traffic-source dimensions. The mapping is specific: utm_source, utm_medium, and utm_campaign feed the core dimensions, utm_id powers the manual campaign ID, and utm_source/medium combinations drive GA4's default channel grouping. Knowing the exact mapping prevents tags that look fine but land in the wrong channel.
- UTM reporting in Looker Studio
Looker Studio (formerly Data Studio) connects to GA4 and other sources to visualise UTM-driven campaign data. The GA4 connector exposes Session source, Session medium, Session campaign, and the manual content/term dimensions, which you place on tables and charts to build a campaign report. This page covers the connector dimensions and how to avoid common breakdown mistakes.
- UTM limits for multi-touch attribution
UTM tags are excellent at labelling a click, but a customer journey has many touches and UTM only stamps the ones that pass through tagged links. This page is an honest account of the last-non-direct caveat and the limits of building multi-touch attribution on UTM alone.
- Attribution analytics
Model campaign attribution beyond the analytics UI.
Sources and verification notes
- Google Analytics Help — BigQuery Export schemaWhere traffic-source and event_params campaign fields live.
Last reviewed 2026-06-24. Facts are checked against primary/official sources where available; uncertain specifics are marked “Data not yet verified” rather than guessed.