Skip to content
Tutorials Center
My learning

Topics

Lesson 24 of 38 ยท Analytics and Attribution

UTM Parameters and Campaign Tracking

Learn UTM parameters, naming conventions, and how to build and validate tracked links in code so your analytics channel reports stay accurate.

When a visitor arrives at your site, analytics must decide where they came from. Sometimes it can tell (a search engine sends a referrer), but often it cannot: email links, messaging apps, social apps and PDFs frequently arrive as "direct". UTM parameters are tags you add to a link's address so the visit is labeled exactly the way you want. They cost nothing and are the foundation of channel reporting.

The five parameters

A tracked link looks like this:

TEXT
https://example.com/spring-sale?utm_source=newsletter&utm_medium=email&utm_campaign=spring_sale_2026&utm_content=hero_button&utm_term=shoes
Parameter Question it answers Example
utm_source Which site or sender? newsletter, facebook, google
utm_medium Which kind of channel? email, cpc, social, affiliate
utm_campaign Which campaign? spring_sale_2026
utm_content Which creative or link? hero_button, video_a
utm_term Which keyword (paid search)? trail_shoes

Source, medium and campaign are the core three; use content and term when you need to compare variants.

Never put UTM tags on links inside your own site (menu to a page, banner to a page). They start a new session and overwrite the real source of the visit. Use them only on links that bring people from outside.

Naming conventions

Analytics treats Email, email and e-mail as three different values. Agree on rules and write them down:

  1. Lowercase only.
  2. Underscores instead of spaces (spaces turn into %20).
  3. A fixed list of allowed mediums (for example: cpc, email, social, affiliate, referral, display).
  4. Campaign names with a pattern, such as _{year}_{market}.
  5. No personal data (never an email address or name in a URL).

Many platforms have automatic tagging (Google Ads has auto-tagging with gclid) which replaces manual UTMs for that platform. Do not mix the two without understanding how your tool treats them.

A small helper keeps the team consistent. It lowercases, replaces spaces and refuses unknown mediums.

JS UTM link builder

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Read the tags back

The reverse is also useful: parse a URL to check its tags, for example in an audit of links found on your pages.

JS Audit tagged links

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Where tags show up

In analytics, source and medium combine into the source / medium dimension (for example newsletter / email). Channel groupings then bucket these into channels such as Email, Paid Search, Organic Social and Referral using rules. If your medium is not one the tool recognizes (for example paid-social-fb), the visit may land in an "Unassigned" or "Other" channel. Check the rules of your tool and pick mediums it understands.

Beyond UTMs

  • Auto-tagging: ad platforms add click IDs (like gclid) that link clicks to cost data.
  • Offline and QR codes: give each placement its own short link with tags.
  • Promo codes and "how did you hear about us": cover channels that links cannot see, such as podcasts and word of mouth.
  • Server-side tracking and consent: browsers and privacy rules limit cookies; plan for consent.

Tagging feeds the models in attribution and the reports in dashboards and reporting.

Common mistakes

  • Mixed case and spelling variants that split one channel into many rows.
  • Tagging internal links.
  • Tagging organic search traffic: the engine already passes a referrer.
  • Forgetting to tag email, the biggest source of unexplained "direct" traffic.
  • Long messy campaign names nobody can read in a report.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which three UTM parameters are the core set?

    Source, medium and campaign identify where, how and why a visit came.
  2. 2. Why should you avoid UTM tags on internal site links?

    Internal tags make real sources look like your own links.
  3. 3. What problem do mixed-case values like Email and email cause?

    Analytics values are case sensitive, so naming rules matter.
  4. 4. Which UTM parameter is meant for the paid keyword?

    utm_term identifies the keyword, mainly for paid search.

Summary

  • UTM tags label visits so analytics knows the true source.
  • Use lowercase, underscores and a fixed list of mediums; never tag internal links.
  • Build and audit links in code or a shared sheet to keep names consistent.
  • Auto-tagging, promo codes and surveys cover what links cannot.

Next: Attribution Models