Skip to main content

View Latest

New Delhi31°C
Markup, feeds and tagged links

UTM link builder

UTM link builder

Add campaign parameters to a URL with the values encoded properly, keeping any query string and fragment already on the link intact.

How this is calculated

The destination is parsed, existing query parameters are preserved, and each supplied utm value is percent-encoded as a query component before being appended. The fragment stays at the end. Values are lowercased and spaces turned to hyphens when you choose that convention.

  • Case matters. utm_source=Newsletter and utm_source=newsletter are two different sources in a report, which is why the convention is a choice on the form rather than something applied silently. Pick one and keep it across every link the team builds.
  • Never tag internal links. A campaign parameter on a link between two pages of your own site starts a new session in most analytics packages and overwrites the original source, so the traffic you were trying to measure disappears.
  • These parameters are visible to anyone who sees the link and are frequently stripped by privacy tools and link shorteners. They are a reporting convention, not a tracking guarantee.
  • An existing utm parameter on the destination is replaced rather than duplicated, because two values for one key leave the choice to the analytics parser.

A campaign parameter is a reporting convention, and conventions only work when everyone keeps them. The most common way UTM tracking fails is not a broken link — it is two people spelling the same source differently.

Case and vocabulary are the whole problem

utm_source=Newsletter and utm_source=newsletter are two different sources in a report. The same applies to email versus e-mail versus Email, and to a campaign named one way in January and another way in February. That is why the case convention is an explicit choice on this form rather than something applied silently, and why the medium vocabulary should be agreed before the first link is built.

Values are percent-encoded as query components, so a space or an ampersand in a campaign name does not break the URL. Any query string and fragment already on the destination are preserved, and an existing utm parameter is replaced rather than duplicated, because two values for one key leave the choice to the analytics parser.

Never tag an internal link

A campaign parameter on a link between two pages of your own site starts a new session in most analytics packages and overwrites the original source. The traffic you were trying to measure disappears into a self-referral, and the report shows your own site sending you visitors.

These parameters are visible to anyone who sees the link and are frequently stripped by privacy tools, browser features and link shorteners. They are a convention for your own reporting, not a tracking guarantee, and a share of tagged clicks will arrive untagged no matter how carefully the link was built.

Questions readers ask

Which parameters are required?

source, medium and campaign are the three every analytics package expects. term and content are optional and are used for paid keywords and for distinguishing variants of the same link.

Should I use a link shortener on top?

Only if it preserves the query string through the redirect. Many strip or rewrite parameters, which silently removes the tracking you just built. Test the final destination, not the short URL.