UTM parameters in redirects
Redirects are where UTM attribution quietly dies. A 301/302 or a link shortener that does not forward the query string strips your tags before the visitor reaches the landing page. This page explains how to preserve UTM parameters through redirects, shorteners, and vanity URLs.
How redirects lose UTMs
An HTTP redirect sends the browser to a new Location. If that Location URL is hard-coded without the original query string, the UTM parameters are gone. The most common culprits are:
- Shorteners that redirect to a fixed target without appending the query
- www↔non-www or http↔https redirects that drop ?utm_…
- Marketing vanity URLs that 302 to a clean landing page
- Locale or A/B redirects that rebuild the URL from scratch
Preserving the query string
The fix is to forward the incoming query string when you build the Location. In most servers and CDNs the redirect rule can carry the original query through (for example, keeping the query in an Nginx rewrite, or appending it in application code).
Worked example (concept):
Incoming: /go/spring?utm_source=email&utm_medium=newsletter Redirect Location: /pricing?utm_source=email&utm_medium=newsletter
The parameters must appear on the final URL, not just the first hop.
Test the whole chain
Multi-hop chains (shortener → vanity → canonical) can drop parameters at any step. Test by following the full chain and confirming the tags are present at the final landing page, not by checking only the first redirect.
How it appears in analytics and logs
If a campaign that you tagged shows up as direct or untagged, a redirect that dropped the query string is a prime suspect. Preserving the query string through redirects restores the lost attribution.
Diagnostic use case
Ensure UTM parameters survive every redirect hop — shortener, vanity URL, www/https canonicalization — so the landing page and analytics still see them.
What WebmasterID can help detect
WebmasterID records attribution at the request that carries the parameters; ensuring redirects forward the query string means that request reaches a URL WebmasterID can see with the tags intact.
Common mistakes
- Assuming a shortener forwards the query string — many do not by default.
- A canonical www/https redirect silently stripping ?utm_… parameters.
- Testing only the first hop of a multi-step redirect chain.
- Rebuilding the URL in a locale/A-B redirect without re-attaching UTMs.
Privacy and accuracy notes
Forwarding the query string moves only the campaign parameters you set. Keep those parameters free of personal data, since they will be visible at the final URL and in logs along the chain.
Frequently asked questions
- Do 301 and 302 redirects preserve UTM parameters?
- Only if the redirect target includes the query string. The status code itself does not strip parameters — a redirect rule that hard-codes a clean target URL does.
Related pages
- UTM stripping and clean URLs
UTM parameters do their job at the moment of capture; leaving them in the visible URL invites messy shares, duplicate-looking URLs, and accidental re-tagging. This page explains stripping UTMs with history.replaceState after your analytics has read them, and how to keep canonical URLs clean without losing attribution.
- UTM validation and QA
Most UTM data problems are preventable with a validation step before links go live. This page describes what to check on every tagged URL — presence of the core parameters, lowercase consistency, proper URL encoding, no double question marks — and a lightweight QA workflow so broken or inconsistent tags never reach production.
- QR code campaign tracking with UTM
A QR code is just an encoded URL, so encoding a UTM-tagged link turns print, packaging, and signage into measurable offline-to-online traffic. This page shows the structure, a worked example, and the rule that no personal data goes in the encoded URL.
- Website observability
Spot campaigns landing as direct when a redirect drops the tags.
Sources and verification notes
- MDN — Redirections in HTTPHow redirects rebuild the target URL, including the query string.
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.