UTM tags

What UTM tags are

UTM tags (Urchin Tracking Module) are parameters added to a link to tell where a visitor came from: which site, which kind of advertising, which campaign. The name comes from Urchin, a web analytics company that Google bought in 2005 and turned into Google Analytics.

Technically they are ordinary query parameters after the ? of a URL. The page itself ignores them; the analytics script on the page reads them.

The parameters

Five classic parameters, in any order:

ParameterTellsExample
utm_sourceThe site or service the visitor came fromutm_source=newsletter
utm_mediumThe kind of channel: paid click, email, socialutm_medium=cpc
utm_campaignThe campaignutm_campaign=spring_sale
utm_termThe paid search keywordutm_term=running+shoes
utm_contentWhich link or banner was clicked, to tell apart links in the same ad or emailutm_content=logolink

Google Analytics 4 also reads utm_id, utm_source_platform, utm_creative_format and utm_marketing_tactic.

Examples

Two tags, for a link in a newsletter:

https://www.example.com/spain/?utm_source=newsletter&utm_campaign=web_utm

All five, for a link posted in a social network by a scheduling tool:

https://www.example.com/bikes/?utm_source=example.org&utm_medium=social&utm_campaign=buffer&utm_content=buffercf3b2&utm_term=city+bike

Spaces and other special characters in a value must be encoded, as + or %20; see URL encoding.

Where they show up

Google Analytics, Yandex Metrica and most other analytics tools read the tags and build reports by source, medium and campaign; with goals they show which campaign brings the visitors that buy, see Yandex Metrica: goals.

The tags also stay in the request line of the web server log, so they can be counted without any analytics. On a typical Linux server with Nginx:

grep -o 'utm_source=[^& ]*' /var/log/nginx/access.log | sort | uniq -c | sort -rn

Rules

Article authors: Andrei Olegovich, Klavdiya Kondakova