The short answer
A UTM code is the extra text added to the end of a web address to label where a visitor came from. It is made of parameters whose names start with utm_, after a question mark and separated by ampersands. Analytics tools such as Google Analytics read those labels when the page loads. The page itself does not change.
UTM stands for Urchin Tracking Module, after Urchin, the analytics company Google bought in 2005 and whose software became the first version of Google Analytics. The name stuck.
Example result
https://example.com/winter-sale?utm_source=newsletter&utm_medium=email&utm_campaign=winter-sale&utm_content=header-buttonThe six parameters
Three parameters are effectively required, because reports are much less useful without them. utm_source is where the link was placed: newsletter, facebook, google, a partner's site. utm_medium is the type of channel: email, social, paid_social, cpc, referral. utm_campaign is the promotion: winter-sale, q1-webinar.
Three are optional. utm_content tells apart links in the same place, such as two buttons in one email or two versions of an ad. utm_term is mainly for paid search keywords. utm_id is a campaign ID, which Google Analytics 4 can use to match imported cost data. The campaign naming guide covers when to use it.
Example result
utm_source where newsletter
utm_medium channel type email
utm_campaign promotion winter-sale
utm_content which link header-button (optional)
utm_term keyword running-shoes (optional)
utm_id campaign ID bf26-001 (optional)How the code is written
The first parameter follows a question mark and each later one follows an ampersand. If the address already has a query string, the UTM parameters are added to it with an ampersand rather than a second question mark. A fragment, the part after #, must stay at the very end.
Values are URL-encoded. A space becomes a plus sign, and characters such as & or # inside a value are encoded so they do not break the address. That is why hyphenated lowercase values, such as spring-sale rather than Spring Sale, are easier to read and less error-prone.
Example input
Campaign typed as: spring saleExample result
https://example.com/shoes?utm_source=newsletter&utm_medium=email&utm_campaign=spring+saleUse a builder instead of typing it
Typing UTM codes by hand works, but it is easy to drop an ampersand, mix capitals or put a parameter after the #. A UTM builder takes the destination and each value, handles the encoding, keeps existing parameters and the fragment where they belong, and can lowercase values and turn spaces into hyphens for you. Toolpane's builder also has platform presets, a campaign ID field, bulk mode for lists of links, and Read existing tags for checking a link someone else made.
For a full walkthrough, see how to create a UTM link.
Common questions
Is a UTM code the same as a tracking pixel? No. A UTM code is plain text in a link. It does nothing unless the destination site has analytics that reads it.
Can visitors see it? Yes, it appears in the address bar and is copied if someone shares the link, so do not put private information in UTM values.
Does it affect SEO? Tag links you share outside your site, such as emails and ads, rather than your own internal links. Many sites also use canonical tags so tagged and untagged addresses are treated as the same page.