UTM Tracking Broken After # Hash? Here's Why (And Fix)
Your UTMs work everywhere except after anchor links. The hash symbol is silently killing your campaign tracking. Here's the 2-minute fix.
You test your campaign URL in a builder, see all the UTMs, and ship it. One week later GA4 shows zero campaign data—everything is Direct or Referral.
When you look closely at the URL you shipped, it looks like this:
https://yoursite.com#pricing?utm_source=linkedin&utm_medium=paidsocial&utm_campaign=launch
The UTMs are there, but GA4 never sees them. The culprit is the hash.
This guide explains why anything after # breaks UTM tracking and how to fix anchor‑link URLs in a couple of minutes.
Table of contents
🚨 Not sure what's breaking your tracking?
Run a free 60-second audit to check all 40+ ways UTM tracking can fail.
Scan Your Campaigns Free✓ No credit card ✓ See results instantly
Why the Hash (#) Breaks UTMs
Browsers treat # as a fragment or anchor indicator:
- Everything before
#is the actual URL sent to the server. - Everything after
#is kept in the browser and used for scrolling or client‑side routing.
So for:
https://yoursite.com#pricing?utm_source=linkedin&utm_medium=paidsocial
The server (and GA4) only sees:
https://yoursite.com
All UTM parameters live in the fragment and never reach GA4.
😰 Is this your only tracking issue?
This is just 1 of 40+ ways UTM tracking breaks. Most marketing teams have 8-12 critical issues they don't know about.
• 94% of sites have UTM errors
• Average: $8,400/month in wasted ad spend
• Fix time: 15 minutes with our report
✓ Connects directly to GA4 (read-only, secure)
✓ Scans 90 days of data in 2 minutes
✓ Prioritizes issues by revenue impact
✓ Shows exact sessions affected
The Correct URL Order
UTMs belong before the hash, not after.
- ✅ Correct:
https://yoursite.com/pricing?utm_source=linkedin&utm_medium=paidsocial&utm_campaign=launch#section - ❌ Wrong:
https://yoursite.com/pricing#section?utm_source=linkedin&utm_medium=paidsocial&utm_campaign=launch
Rules of thumb:
- Only one
?per URL. - Query parameters (including UTMs) go after
?and are separated by&. - The hash, if used, comes last and never contains UTMs that you care about in GA4.
How to Fix Existing Campaign URLs
If you’ve already shipped URLs with UTMs after #:
- Update the URL pattern in your ad platform, email tool, or CMS so UTMs appear before the hash.
- Where possible, redirect old “bad” URLs to the corrected format.
- For example, redirect
https://yoursite.com#pricing?utm_source=...tohttps://yoursite.com?utm_source=...#pricing.
- For example, redirect
- In future campaigns, ensure anchor fragments are always at the end of the URL.
You won’t recover historical data for the broken URLs, but you can stop the problem going forward.
Special Case: Single‑Page Apps (SPAs)
SPAs and front‑end routers often use hashes or client‑side navigation:
- On the first hit, GA4 needs the full URL with UTMs before the hash.
- After that, client‑side route changes should not strip or overwrite query parameters.
Best practices:
- Read UTMs on the initial page load and store them (e.g., in a cookie or local storage).
- Keep query parameters intact when updating routes (pushState/replaceState).
- Do not move UTMs into the hash for “cleaner” URLs—GA4 will lose them.
QA Checklist Before Launch
Before shipping any campaign that uses anchor links or SPAs:
- Click the actual link in a preview or test environment.
- Confirm the browser address bar shows UTMs before
#. - Confirm there is exactly one
?and that all UTMs are joined with&. - In GA4 Realtime, verify that source/medium/campaign appear as expected for your test visit.
- On SPAs, navigate within the page and confirm the query string (with UTMs) is still present.
✅ Fixed this issue? Great! Now check the other 39...
You just fixed one tracking issue. But are your Google Ads doubling sessions? Is Facebook attribution broken? Are internal links overwriting campaigns?
• Connects to GA4 (read-only, OAuth secured)
• Scans 90 days of traffic in 2 minutes
• Prioritizes by revenue impact
• Free forever for monthly audits
Join 2,847 marketers fixing their tracking daily
FAQ
Can I put UTMs after the hash if I use a SPA?
No. The fragment is never sent to GA4 or your server. If you must keep state in the hash for routing, also ensure GA4 gets the UTMs from the initial full URL before the hash.
Do fragments affect channel attribution?
No. GA4 determines attribution based on the URL before # and the referrer/UTMs present there. Anything after the fragment is invisible to GA4.
What if a 3rd‑party tool appends parameters after the hash?
Those parameters will not affect GA4. Work with the vendor to move relevant tracking data into the query string if you need it in your analytics.
Can I have multiple hashes in a URL?
Browsers only honor the first #. Everything afterwards is part of the fragment and won’t reach the server or GA4.
How do I handle deep links into sections of long content?
Use anchor links, but always put them at the end of the URL after UTMs. For example: ?utm_source=...#section-name.