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.
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.
- Built-in URL variable, component Query, one per UTM key
- Custom JavaScript variable for normalisation or defaults
- Values read from the page URL when 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
- Assuming GTM captures UTM automatically — you must define URL variables.
- Reading UTM on an interior page where the query string is already gone.
- Forwarding UTM through marketing tags without gating on consent.
- Letting casing vary because the URL variable returns the raw value verbatim.
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
- 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 parameters and consent
Consent banners and consent-mode setups change when and how campaign data is recorded. UTM parameters live in the URL regardless of consent, but whether they are written into a cookie-based analytics tool depends on the visitor's choice. This page explains keeping UTM attribution privacy-safe and consent-aware.
- Auto-tagging vs manual UTM tagging
Some ad platforms auto-tag clicks with their own identifier (for example a click ID), while you also add manual UTMs. Used together carelessly, the same click gets attributed two ways. This page explains how auto-tagging and manual UTMs relate, which to trust per channel, and how to avoid conflicts.
- Events docs
Route campaign data to tools from one container.
Sources and verification notes
- Google Tag Manager Help — VariablesBuilt-in URL variable reads query keys such as utm_source from the page URL.
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.