How-To & Life · Guide · Developer Utilities
How to build UTM links
utm_source/medium/campaign/content/term taxonomy, naming conventions, lowercase consistency, shortening for social, and auditing broken UTMs.
UTM parameters are the five query-string tags Google Analytics and every other major analytics platform read to attribute a visit to a specific marketing channel, campaign, and creative. The parameters themselves are trivial — five predictable keys appended to a URL — but the conventions around naming, casing, and taxonomy decide whether your reports are useful or a pile of near-duplicates that have to be cleaned every quarter. This guide covers each of the five parameters and when to use it, the naming rules that prevent Facebook and facebook from showing up as separate sources, the quirks of GA4 vs Universal Analytics, a taxonomy template you can adopt wholesale, and the common mistakes that make retroactive fixes necessary.
Advertisement
What UTMs are
UTM stands for “Urchin Tracking Module” — Urchin was the analytics company Google bought in 2005, the bones of which became Google Analytics. The parameters are just query-string keys; any analytics tool that reads URLs can pick them up.
A tagged link looks like:
https://example.com/pricing ?utm_source=newsletter &utm_medium=email &utm_campaign=spring_2026_launch &utm_content=hero_button &utm_term=pricing
The five parameters
utm_source — the platform or vendor (google, facebook, newsletter, partner_acme). Answers “where did the click come from?” Always required.
utm_medium — the marketing channel type (cpc, email, social, display, affiliate, organic). Answers “what kind of traffic?” Always required.
utm_campaign — the initiative the link is part of (spring_2026_launch, black_friday). Always required.
utm_content — differentiates multiple links within the same campaign (hero_button vs footer_link, or A/B creative variants). Optional but strongly recommended when you have more than one link per campaign.
utm_term — the paid keyword for search ads. Legacy use; auto-tagging with {keyword} in Google Ads fills it automatically. Rarely hand-set.
Naming rules that save hours later
Three rules prevent 90% of taxonomy drift.
All lowercase. UTM values are case-sensitive. Email and email are two different sources in your report. Force lowercase at the point where the link is built.
Underscores between words. Spaces get encoded as %20 or +, which looks awful in reports and breaks some tools. Use _ consistently.
Controlled vocabulary. Write down the allowed values for each parameter. A medium of e-mail, email, newsletter, and eblast all mean the same thing — pick one and document it.
A minimal taxonomy:
utm_medium allowed values: cpc paid search display banner ads paid_social Facebook/Instagram/LinkedIn/TikTok paid email transactional + newsletter affiliate partner links referral non-paid links from other sites organic_social unpaid social posts qr printed QR codes
Only tag external links
UTMs are for links that bring users to your site from outside. Tagging internal links breaks session attribution — GA4 resets the session when it sees a new campaign, so an internal link with UTMs creates a spurious “new visit” from the user clicking within your own site. Never UTM-tag a link on your own domain.
GA4 differences from Universal Analytics
GA4 reads the same five parameters, but it also understands two newer ones Google introduced in 2023:
utm_source_platform — a higher-level grouping above source (e.g., Google Ads, Display & Video 360).
utm_creative_format and utm_marketing_tactic — optional dimensions for paid media.
GA4 also resets the session on new source/medium by default, where UA had a 30-minute window. If you need UA-style behavior, adjust the session timeout in Admin.
URL-encoding UTM values
If a value contains spaces, punctuation, or non-ASCII, it must be percent-encoded. The easiest way to avoid the problem is to forbid those characters in your taxonomy. If you must include them, encode the value: utm_campaign=q1%20relaunch for “q1 relaunch”.
UTMs and multi-touch attribution
Default GA4 attribution is data-driven or last-click. The UTMs on the last non-direct click before conversion win the credit. If you run retargeting heavily, your utm_medium=display will appear to drive most conversions simply because it fires late in the funnel. Use GA4’s attribution reports or an external model to see first-touch and assisted contributions.
Shortening and redirects preserve UTMs
A 301 or 302 redirect preserves query parameters by default in every compliant server. Link shorteners (bit.ly, rebrand.ly) also pass UTMs through. The one place UTMs get stripped is aggressive privacy browsers and some email apps — but the parameters are passed along to the landing page in almost every real-world case.
Privacy and referral leaking
UTMs on a URL expose your marketing taxonomy publicly. If a user shares a UTM-tagged link on social media, anyone clicking sees your naming scheme and attributes themselves to the original campaign. Two mitigations: strip UTMs from the URL with history.replaceState once the analytics hit fires, or use a link shortener that rewrites to a clean destination.
Common mistakes
Case drift. utm_source=Facebook one week, utm_source=facebook the next. Report splits them into two lines forever. Force lowercase in the tool that generates links.
Tagging internal links. Breaks session continuity; inflates “new visits”; corrupts attribution. UTMs are external-only.
Encoding spaces as + inconsistently. GA4 reads both %20 and +, but reports display whichever was in the URL, so spring+launch and spring%20launchlook like two campaigns. Just avoid spaces entirely.
Missing medium. GA4 falls back to (not set) when medium is missing, which collapses into (direct) / (none) in channel grouping and disappears from paid-channel reports. Never leave medium empty.
Reusing campaign names across years. utm_campaign=spring_sale in 2025 and again in 2026 blurs year-over-year analysis. Always include the year: utm_campaign=spring_sale_2026.
Free-text creative names. utm_content=big_red_button one time, utm_content=cta1 the next. Fine for tiny teams; becomes a mess at scale. Document utm_content conventions in your taxonomy spec.
Run the numbers
Generate properly-formatted, lowercased UTM links with the UTM builder. Pair with the UTM parser to audit links your team has already shipped, and the URL cleaner for stripping tracking parameters out of shareable or canonical URLs.
Advertisement