WebmasterID logoWebmasterID
UTM tracking

UTM and Google Tag Manager

Google Tag Manager does not capture UTM parameters by itself, but it can read them from the page URL using built-in URL variables or custom JavaScript, expose them in the dataLayer, and pass them to any tag. This makes GTM a flexible place to route campaign data to multiple tools without editing site code for each one.

Verified against primary sources

Reading UTM in GTM

GTM provides a built-in URL variable type that can return a specific query key. Configure one variable per UTM parameter (component: Query, key: utm_source, and so on) and you have utm_source, utm_medium, utm_campaign, utm_term, and utm_content available to any tag or trigger.

For more control you can use a Custom JavaScript variable to parse the query string, normalise casing, or apply a default. Either way, GTM reads from the current page URL at the moment the trigger fires.

Passing UTM to tags and the dataLayer

Once each UTM is a GTM variable, reference it in tag fields to forward campaign data to analytics or advertising tags. You can also push the values into the dataLayer so other tags and triggers can react to them within the same page.

Because GTM fires client-side after consent and after any redirects, the values it sees reflect the final landing URL, not necessarily the originally clicked link. Place consent checks on marketing tags so UTM data is only sent when the visitor has allowed it.

How it appears in analytics and logs

A GTM URL variable that resolves to a UTM value means the parameter was present in the page URL when the trigger fired. An empty variable means the parameter was absent, removed by a redirect, or read on a later page that no longer carried the query string.

Diagnostic use case

Read utm_source, utm_medium, and utm_campaign from the landing URL inside GTM and forward them to analytics or marketing tags, so campaign data reaches several tools from one container.

What WebmasterID can help detect

WebmasterID records the inbound campaign arrival server-side, so you can verify what reached your origin regardless of whether a GTM tag fired, consent blocked it, or the value was lost between pages.

Common mistakes

Privacy and accuracy notes

Tags fired through GTM can send UTM values to several destinations, so keep personal data out of UTM parameters. Respect consent: gate marketing tags on consent state so campaign data is only forwarded when permitted.

Frequently asked questions

Does GTM capture UTM parameters on its own?
No. GTM reads them only when you define URL variables (or custom JavaScript) for each UTM key. It then makes those values available to your tags and the dataLayer.

Related pages

Sources and verification notes

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.