How to capture UTM parameters on WordPress form submissions

Three ways to get campaign data onto your form entries — hidden fields, JavaScript, or automatic capture — and the failure modes of each.

By Parvindar Singh Saini · 22 January 2026 · updated 24 July 2026 · 7 min read

You tag your campaign links properly. The clicks arrive. Then someone fills in your contact form and the campaign data is nowhere — you have a name, an email, and no idea which campaign paid for them.

This is the most common attribution failure in WordPress, and it has a specific cause.

Where the parameters go

UTM parameters live in the URL of the page a visitor lands on:

yoursite.com/?utm_source=newsletter&utm_medium=email&utm_campaign=march

They exist there and nowhere else. The moment that visitor clicks through to another page, the address bar shows a clean URL and the parameters are gone.

Since almost nobody lands directly on a contact form and submits immediately, by the time the form is reached the campaign data has usually vanished. Any method that reads UTM parameters at the point of submission is reading an address bar that no longer contains them.

That is the whole problem: UTM data must be captured on arrival and stored, not read at submission.

Approach 1: Hidden fields

Add hidden fields named utm_source, utm_medium and so on, then populate them.

Almost every form plugin supports this, so it is the usual first attempt. It is also the most fragile:

  • The fields only populate if the visitor submits on the landing page
  • Someone edits the form months later, deletes a field that looks unused, and campaign data stops arriving
  • Every new form needs the same fields added again
  • Nothing alerts you when it breaks — the data just goes quiet

That last point is what makes it genuinely dangerous. A broken tracking setup looks identical to a campaign that produced no leads.

Approach 2: A JavaScript snippet

The more robust do-it-yourself version: on arrival, read the UTM parameters and store them in a cookie or sessionStorage. On submission, write the stored values into hidden fields.

// On arrival — store whatever is present
const params = new URLSearchParams(window.location.search);
['utm_source','utm_medium','utm_campaign','utm_term','utm_content']
  .forEach(k => {
    const v = params.get(k);
    if (v) sessionStorage.setItem(k, v);
  });

This survives multi-page visits, which is a real improvement. But you still maintain the hidden fields, you still write the code that populates them, and you still get no warning when a form edit breaks the link between the two.

You have also solved only the UTM half. The referrer, the landing page and the pages viewed are still unrecorded, and those matter as much — most visits arrive with no UTM parameters at all.

Approach 3: Automatic capture

The alternative is a form plugin that treats the visit as part of the submission rather than something separate.

Sense Forms records all five UTM parameters on arrival, holds them for the session, and attaches them to whatever form is eventually submitted. It also records the referrer, the landing page, every page viewed, and the device — none of which UTM tagging covers.

There are no hidden fields, so there is nothing to forget when building a new form and nothing to accidentally delete when editing an old one.

Whichever method you use, the data is only as good as your tagging. The five parameters:

Parameter Purpose Example
utm_source Where the click came from newsletter
utm_medium The type of channel email
utm_campaign The specific campaign march-promo
utm_term Paid search keyword wordpress form plugin
utm_content Which creative or link header-cta

Two habits prevent most reporting mess:

Be consistent with case. Google and google are different values and will split into two rows in every report you build.

Never tag internal links. Adding UTM parameters to a link between two of your own pages resets the visitor’s attribution to that tag, overwriting the real source. It is a surprisingly common way to convert a page’s entire organic traffic into a mystery campaign.

What untagged traffic tells you

Most visits carry no UTM parameters at all — organic search, direct visits and ordinary referrals never do.

This is why UTM capture alone is not attribution. If your only signal is UTM parameters, every untagged visit becomes an unknown. Recording the referrer and landing page alongside them is what turns a partial picture into a complete one.

For how Sense Forms classifies traffic when no UTM parameters are present, see how attribution works.