Skip to content
FunnelGuard

Fix guide by FunnelsGuard

First-touch vs last-touch UTM fields swapped: how to fix it

TRK-280Low impactOther toolBy FunnelGuardPublished Updated
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.

Same lead, two mappings

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.

Credit for the same 100 leadsExample numbers
Credit for the same 100 leads (example)Paid social (correct): 40 leads; Paid social (swapped): 15 leads; Search (correct): 20 leads; Search (swapped): 45 leads0173440152045Paid social (correct)Paid social (swapped)Search (correct)Search (swapped)leads

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

Run a known two-visit test
  1. 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.

  2. Return with a second campaign

    In the same window, open the site again with ?utm_source=test_last&utm_medium=email&utm_campaign=last.

  3. Submit the form

    Use a test email address you can recognise later.

  4. Compare in the CRM

    Open the new contact. First-touch fields should show test_first and last-touch fields should show test_last.

  5. 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.

Fix by platform
  1. 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.

  2. 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.

First touch saved once, last touch updatedjavascript
(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.

Expected result of the test
FieldExpected value
first_utm_sourcetest_first
last_utm_sourcetest_last
first_utm_campaignfirst
last_utm_campaignlast

How to prevent it happening again

Keep attribution fields clean
  • 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.

Does FunnelGuard catch this?

Other tool

Needs a different kind of tool.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.