HomeGuides › UTM links

UTM links that do not break your reporting

The encoding problems that break the link, and the naming problem that breaks the report.

What a UTM actually is

Five optional parameters bolted onto the end of a URL. Analytics reads them and files the visit accordingly. They are just query parameters — there is nothing clever about them, which is why they break in ordinary ways.

The first three are the ones that matter. Without all three, the traffic does not group properly with the rest of the campaign.

Source or medium?

This is the confusion that produces unusable reports. A test that works: if you stopped advertising tomorrow, the source is the thing that would still exist and the medium is the thing that would stop. Facebook would still exist; paid clicks would stop. So utm_source=facebook and utm_medium=cpc.

Keep mediums to a short, fixed list — four or five — and let sources be as many as you need. Mediums are what you group by; sources are the detail.

The two ways the link breaks

An existing query string

Glue ?utm_source=x onto a URL that already contains ?ref=home and you get a link with two question marks. Everything after the second one is not a parameter any more, and both the existing parameter and your tracking are lost. Any tool that builds links by joining strings does this.

The right approach is to parse the URL, add the parameters properly, and write it back out — which also keeps the fragment at the end, where it must be. A #pricing anchor placed before the query string simply stops working.

Spaces and other characters

A campaign typed as spring sale has to be encoded before it is a valid URL. Unencoded, it breaks at the space when pasted into most messaging apps, and half the link arrives as plain text. Avoid spaces entirely and use hyphens.

The expensive problem: naming drift

This one does not break anything. It quietly ruins the report.

facebook, Facebook, FB and face-book are four different sources as far as analytics is concerned. They appear as four rows, each holding part of the traffic, and none of them shows the real total. Nothing warns you. Everything looks fine until somebody tries to work out what the campaign actually did, by which time it is over and the data cannot be fixed retrospectively.

Three rules prevent all of it:

  1. Lower case, always. Analytics is case-sensitive here and there is no reason to ever use a capital.
  2. One separator. Pick hyphens or underscores and never mix them.
  3. Write the list down. A short, shared list of allowed sources and mediums, which people check against rather than inventing from memory.

Checking a batch of links against those rules before they go out takes a minute and is the only point at which the problem is cheap to fix.

Do not tag your own internal links

Putting UTMs on links between pages of your own site starts a new session and overwrites the original source. The visitor who arrived from your newsletter becomes an internal-campaign visitor, and the newsletter loses the credit. Tag only links arriving from somewhere else.

Exporting to a spreadsheet

A campaign value beginning with =, +, - or @ is treated as a formula by Excel and Sheets, and run when the file is opened. That is a real way to attack whoever opens your export. Prefixing the cell with an apostrophe stops it and does not show in the cell — which is what the CSV export here does automatically.

Frequently asked questions

What is the difference between source and medium?

Source is where the traffic came from; medium is the kind of link. If you stopped advertising tomorrow, the source would still exist and the medium would stop.

Why does capitalisation matter?

Analytics treats utm_source=Facebook and utm_source=facebook as two different sources. They become separate rows, each with part of the traffic, and nothing warns you. Lower case everywhere avoids it entirely.

Will adding UTMs break a link that already has parameters?

Not if the URL is parsed properly rather than having text appended. A tool that concatenates produces two question marks and loses everything after the second.

Should I tag links between pages of my own site?

No. Internal UTMs start a new session and overwrite the original source, so the campaign that actually brought the visitor loses the credit.

Do I need all five parameters?

Source, medium and campaign are needed for the traffic to group properly. Term and content are optional.

Is the CSV export safe to open in Excel?

Yes. Values starting with =, +, - or @ are exported with a leading apostrophe so the spreadsheet does not execute them as formulas.

Open the UTM Builder →