How-to Guides Web & HTTP

How to Build UTM Links for Campaign Tracking

Tag links with utm_source, utm_medium and utm_campaign so analytics shows which email, post or ad sent each visit, with a naming convention that stays clean.

Last reviewed:

AdSense Placeholder
Slot: header_reference_page
On this page

Steps

  1. Decide the naming convention first

    Agree on lowercase values with underscores or hyphens instead of spaces, and a short fixed list of mediums such as email, social, cpc and referral. Write it down so every campaign follows it.

  2. Start from the final landing page URL

    Copy the exact address people should land on, such as https://example.com/spring-sale?ref=home. Test that it works before you tag it, and avoid links that redirect away from the landing page, which can drop the tags.

  3. Fill in the builder

    Enter the URL, then source (where the traffic comes from, such as newsletter), medium (email) and campaign name (spring_sale) in the UTM Link Builder. Add utm_content when you need to tell two links in the same message apart.

  4. Check the result

    The builder keeps existing parameters and appends the tags: https://example.com/spring-sale?ref=home&utm_source=newsletter&utm_medium=email&utm_campaign=spring_sale&utm_content=header_button. Paste the finished link into the URL Parser to confirm each parameter is listed separately and the ref parameter survived.

  5. Shorten or encode if needed

    If a value must contain spaces or special characters, build it with the Query String Builder so it is percent-encoded properly. Share the long link in email; for print or social posts use a link shortener you control.

  6. Test the link, then check analytics

    Open the link in a private window, then look for the visit under the matching source, medium and campaign in your analytics tool. Fix any typo before the campaign goes out, because tagged data cannot be corrected afterwards.

What you need

A landing page URL, a campaign name and the place each link will appear (newsletter, post, ad). Everything runs in your browser; the URLs you enter are never sent anywhere.

The five UTM parameters

Parameter Answers Example
utm_source Where did the visitor come from? newsletter
utm_medium What kind of channel was it? email
utm_campaign Which campaign? spring_sale
utm_term Which paid keyword? (optional) running_shoes
utm_content Which link or ad variant? (optional) header_button

A worked example

Starting from https://example.com/spring-sale?ref=home, a link placed on a button in the newsletter header becomes:

https://example.com/spring-sale?ref=home&utm_source=newsletter&utm_medium=email&utm_campaign=spring_sale&utm_content=header_button

The original ref=home parameter is kept, and the tags are separated by &. In a URL the query string always comes before any #fragment, so the tags must go before the #.

Common pitfalls

  • Inconsistent spelling. Email, email and e-mail show up as three different mediums. Use one convention.
  • Tagging internal links. It overwrites the real traffic source. Tag only external links.
  • Putting personal data in a tag. UTM values appear in analytics reports and sometimes in referrer logs. Never put names or email addresses in them.
  • Forgetting that tags are visible. Anyone can see the parameters in the address bar, so do not put anything confidential there.
  • Breaking the URL with raw characters. Spaces, & and # inside a value must be percent-encoded.

Going further

How query strings are structured and encoded is covered in How URLs and Query Strings Work.

Try these tools

See also

  • Guide How URLs and Query Strings Work
    The seven parts of a URL, which characters need percent-encoding and why, how query strings carry repeated keys.
  • Glossary Query string
    A query string is the part of a URL after the question mark that carries named values for the server, such as ?q=shoes&page=2.
  • Glossary URL
    A URL (Uniform Resource Locator) is the address of a resource on the web, such as a page, image or API endpoint.
  • Glossary Short URL
    A short URL is a compact link that redirects to a longer address, made by a link-shortening service.
  • Glossary UTM parameters
    UTM parameters are tags added to the end of a URL, such as utm_source and utm_campaign.

Frequently Asked Questions

Analytics tools generally expect utm_source, utm_medium and utm_campaign. utm_term (paid keywords) and utm_content (variant or link position) are optional.

Yes in most analytics tools: Email and email are reported as different mediums. Pick lowercase and stick to it.

No. A UTM tag on an internal link can overwrite the real source of the visit and start a new session, which ruins attribution. Use UTM tags only on links that bring people in from outside.

AdSense Placeholder
Slot: footer_leaderboard