UTM tags come after the # in the link

Anything after a # in a link is never sent to the server, so UTM tags placed there are easy to lose. Move tags before the # to keep campaigns tracked.

SymptomVisits from the link show as direct or (not set) even though the link has UTM tags.
Likely causeThe tags were added after a # in the address, often on single-page sites or links to a section of a page.
FixMove the ? and every tag before the #, and keep the # part at the very end.

Short answer: The # part of a link, called the fragment, stays in the browser and is not sent to the website's server. UTM tags placed after it may never reach your analytics. Put the ? and all your tags before the #, and keep the #section at the very end.

What is the # part of a link?

Fragment: the part of a web address after a #, used to jump to a section of a page or by single-page apps to track screens, and handled only by the browser.

The web standards are clear on this. RFC 3986 says the query ends at a #, and that the fragment is separated from the rest of the link before it's requested. MDN puts it more plainly: the fragment "is not sent to the server".

Will analytics read UTM tags after a #?

Don't rely on it. The server never sees them, and we found no documentation saying Google Analytics reads UTM tags from the fragment. Treat tags after # as lost and move them.

Even if a script on the page could read the fragment, other parts of your stack probably can't: server logs, redirects, ad platform tags and attribution tools all work from the part before the #.

Why does this happen?

  • Links to a section: someone links to example.com/#offer and adds tags to the end.
  • Single-page sites: some sites use #/page addresses, so every link already contains a #.
  • Templates: an email or ad tool appends ?utm_... to the very end of whatever link it's given.

Example

Tags added after the section link:

https://example.com/#offer?utm_source=newsletter&utm_medium=email&utm_campaign=oct

The fixed link, with tags first and the section at the end:

https://example.com/?utm_source=newsletter&utm_medium=email&utm_campaign=oct#offer

Both open the same section of the page. Only the second sends the tags with the request.

How to fix it

  1. Paste the link into the link checker. It flags parameters that come after the #.
  2. Cut everything from the # up to the first tag, such as #offer.
  3. Paste it back at the very end of the link, after the last tag.
  4. Check that the link now has a ? before the tags, and only one. See two question marks.
  5. If your site uses #/ addresses for every page, ask your developers how they want campaign tags passed. Don't assume the analytics tag will read them.
  6. Build future links in the UTM builder, then add the #section at the end if you need one.
FAQ

Common questions

Can I use a # and UTM tags in the same link?

Yes, as long as the tags come first. The order should be page address, then `?` and tags, then `#` and the section name.

Why does my link still open the right section after moving the #?

The browser handles the fragment itself after the page loads, wherever it sits at the end of the link. Moving it to the end changes nothing for the visitor.

Do click IDs after a # work?

The same rule applies. Click IDs such as `gclid` after a `#` aren't sent to the server either. Ad platforms add click IDs to each click themselves, so you shouldn't be adding them by hand. See [click IDs in shared links](/problems/click-id-in-shared-link/).

Does this affect app links?

It can. Apple's universal link rules can match on the fragment, but tracking tags should still go before it, so the website and any redirects see them.

What are UTM parameters?

UTM parameters are tags added to the end of a link, such as utm_source and utm_campaign, that tell analytics tools where a visit came from. They let you see which campaign, channel and ad brought each visitor.

Which UTM parameters are required?

Use utm_source, utm_medium and utm_campaign on every campaign link. utm_term and utm_content are optional and help you compare keywords or ad variants.