First-touch attribution with UTM parameters on a static site
UTM tags exist only on the first page someone lands on. Store the first touch once, and a sale three pages later can still be credited to the right channel.
Someone clicks a tagged link, lands on your homepage, reads two pages and buys. By the time they click buy, the UTM parameters are long gone and the referrer says your own site. Without storing the first touch, the sale belongs to nobody.
Store it once
- On a visit with no stored touch, read UTM parameters, click ids and the referrer.
- Classify the source: the utm_source, a click id, a known referrer, or direct.
- Save it with the landing page and date, even if the answer is direct.
- Never overwrite it. Attach it to every event from then on.
Ignore your own site
A referrer on your own domain with no UTM tags is navigation, not an arrival. Treat it as nothing, or your site becomes its own biggest traffic source. If a later visit arrives from a different channel, record it separately as the latest touch.
Assistant referrals need their own per-visit grading, covered in tracking ChatGPT and Claude traffic.
Questions
Why do UTM parameters disappear?
They are on the landing URL only. The next page the visitor opens has a clean URL, and its referrer is your own site.
Where should first touch be stored?
In the browser's local storage, written once on the first visit and never overwritten, then attached to every event.
Should direct visits be stored as first touch too?
Yes. Otherwise the slot stays empty and a later internal navigation gets recorded as the source, crediting your own homepage.