On this page
What this issue is
First-touch attribution records the campaign that brought a person to your site the first time. Last-touch attribution records the campaign of the visit just before they became a lead. Most setups store each in its own set of fields, for example first_utm_source and last_utm_source.
The fields are swapped when the values land in the wrong place. Typical causes: hidden form fields mapped to the wrong CRM properties, a script that overwrites the first-touch cookie on every visit, or two tools writing to the same field.
Swapped
- first_utm_source = google (latest visit)
- last_utm_source = facebook (original visit)
- Reports credit the wrong channel
Correct
- first_utm_source = facebook (original visit)
- last_utm_source = google (latest visit)
- Reports match the real journey
Why it costs you leads or sales
The form still works, so you do not lose the lead itself. The damage is in decisions. If first touch is wrong, you under-fund the channels that start journeys. If last touch is wrong, you misjudge the channels that close them. Budget then moves to the wrong place. The business impact is usually low per lead but builds up over months.
Example: the same 100 leads credited to paid social as first touch when fields are correct, versus when the fields are swapped.
How to check if your site has it
Visit with a first campaign
In a clean private window, open your site with ?utm_source=test_first&utm_medium=cpc&utm_campaign=first. Browse a page, then close nothing.
Return with a second campaign
In the same window, open the site again with ?utm_source=test_last&utm_medium=email&utm_campaign=last.
Submit the form
Use a test email address you can recognise later.
Compare in the CRM
Open the new contact. First-touch fields should show test_first and last-touch fields should show test_last.
Inspect the hidden fields
In browser dev tools, check the form's hidden inputs before submitting. Their names should match the intended CRM properties.
How to fix it
The principle is simple: write first-touch values only if none exist yet, and write last-touch values on every new campaign visit. The exact place to do it depends on your stack.
Review cookie variables
Check the First Party Cookie variables that feed your hidden fields. Make sure the first-touch variable reads a cookie that is set once, and the last-touch variable reads one that updates.
Fix the cookie tag
In the tag that sets the cookies, add a condition so the first-touch cookie is written only when it is empty.
Open your form plugin
In the form builder, open each hidden field and check which parameter or cookie it pulls from.
Match field names
Make sure first-touch hidden fields feed the first-touch CRM properties, and the same for last touch. Re-save the form.
Check form field mapping
In the form or survey builder, review hidden fields and which custom contact fields they write to. Compare against the contact's attribution data.
Separate custom fields
Use distinct custom fields for first and last touch so one never overwrites the other.
Use the script below
Store first touch once and last touch on each campaign visit, then copy both into hidden inputs.
(function () {
var keys = ['utm_source', 'utm_medium', 'utm_campaign'];
var params = new URLSearchParams(window.location.search);
function getCookie(n) {
var m = document.cookie.match('(?:^|; )' + n + '=([^;]*)');
return m ? decodeURIComponent(m[1]) : '';
}
function setCookie(n, v) {
document.cookie = n + '=' + encodeURIComponent(v) + '; path=/; max-age=7776000; SameSite=Lax';
}
if (!params.get('utm_source')) return;
keys.forEach(function (k) {
var v = params.get(k) || '';
if (!getCookie('first_' + k)) setCookie('first_' + k, v);
setCookie('last_' + k, v);
});
})();Then fill hidden inputs named for each CRM property from the first_ and last_ cookies when the form loads. In your CRM, also check that workflows or integrations do not rewrite first-touch properties later.
How to confirm it's fixed
Repeat the two-visit test with new campaign names and a fresh private window. First-touch fields must keep the first campaign and last-touch fields must show the second. Then run a third visit with a different campaign and submit again: first touch must not change.
| Field | Expected value |
|---|---|
| first_utm_source | test_first |
| last_utm_source | test_last |
| first_utm_campaign | first |
| last_utm_campaign | last |
How to prevent it happening again
- Name fields clearly: first_ and last_ prefixes, not numbers or abbreviations.
- Document which form field maps to which CRM property.
- Set first-touch properties to write once only.
- Rerun the two-visit test after changing forms, tag managers or CRM workflows.
- Review attribution reports quarterly for sudden shifts that match a site change.
How FunnelGuard handles this
This issue is outside what FunnelGuard checks. FunnelGuard runs your journeys with a robot visitor and checks steps, tracking hits and lead delivery, but it does not audit how your CRM maps first-touch and last-touch values over time across real visitors. A CRM data audit, such as a report comparing the fields across contacts, or a tag debugging tool, fits better. FunnelGuard can still help with nearby problems, like checking that your form submits and the test lead reaches your CRM. A free read-only website audit is available.
Questions people ask
What is the difference between first-touch and last-touch UTM fields?
First-touch fields store the campaign of a person's first visit and should never change. Last-touch fields store the campaign of the most recent visit before they converted and update on each new campaign visit.
Why is my first-touch UTM field showing the latest campaign?
Usually a script or form overwrites the first-touch cookie or property on every visit, or the hidden field is mapped to the wrong CRM property. Make the first-touch value write only when it is empty.
How do I stop my CRM overwriting first-touch source?
Set the property to write once, or remove workflows and integrations that update it. Store the later value in a separate last-touch property instead.
How do I test if my UTM fields are mapped correctly?
Visit your site with two different sets of UTM parameters in the same browser, submit a form, and compare the contact's first and last fields. They should show the first and second campaigns respectively.
Can swapped UTM fields lose me leads?
No, the lead is still captured. The harm is wrong attribution, which can lead you to cut or boost the wrong channels.
Does FunnelGuard detect swapped first-touch and last-touch fields?
No. This needs a CRM data audit or a tag debugging tool. FunnelGuard checks that journeys complete, tracking hits fire and test leads arrive.
Why are first-touch and last-touch values identical?
Often the same cookie or parameter feeds both fields, or the visitor only had one visit. Test with two visits to rule out the second case.
Related issues
- TRK-270UTMs not written to CRM contact fieldsFix guide
- TRK-277Lead source field overwritten on later visitsFix guide
- TRK-278Hidden UTM fields present but emptyFix guide
- TRK-279Hidden fields populated with literal placeholders ({utm_source})Fix guide
- TRK-269HubSpot original source shows 'Offline' for web leadsFix guide
- TRK-268HubSpot form submissions not linked to tracked visitor (hutk missing)Fix guide