Skip to content
TraceLead

WPForms UTM tracking with one CSS class per hidden field

Add a Hidden Field, give it the CSS class tracelead-channel, and TraceLead fills it with where the visitor first came from. The channel, campaign and click id land in the entry, the notification and any CRM the form sends to.

No card needed. No lead caps on any plan.

  • WPForms and WordPress plugin: Tested on every release against the builder's markup
  • How we test
Added to your WPForms entry Sample data

Added by TraceLead's hidden fields. The name and email stay in your form.

Channel
Paid search
Source / medium
google / cpc
Campaign
brand-uk
Click ID
gclid
Arrived from

Why a WPForms hidden field for UTM tags often arrives blank

The common setup gives a Hidden Field a default value that reads utm_source from the page address. It works on the landing page, and only there.

A visitor who clicks your ad onto a service page and fills in the form on /contact brings no UTM tags with them. Neither does anyone who found you through search or a shared link.

Two visits, one enquiry Sample data
  1. Monday Clicks a Google ad, lands on /pricing?utm_source=google&utm_medium=cpc&utm_campaign=brand-uk&gclid=…, leaves.
  2. Thursday Types your address, opens /contact, sends the WPForms form.
Hidden field Read from the URL Filled by TraceLead
tl_channel empty paid_search
tl_source empty google
tl_utm_campaign empty brand-uk
tl_gclid empty Cj0KCQjw…
tl_landing_page /contact /pricing?utm_source=google&utm_medium=cpc

TraceLead keeps the first visit in a first-party cookie on your domain once your banner allows it, and fills the field on whichever page the form is sent from.

How to add UTM tracking to WPForms

WPForms chooses its own input names, so a field cannot simply be called tl_channel. The CSS class is how you tell the plugin which value belongs in which field.

The full WPForms guide
  1. Install the TraceLead WordPress plugin

    Upload and activate the plugin and paste your site ID under Settings → TraceLead. It prints the tag on every page and, when a form renders, marks the Hidden Fields you have tagged.

  2. Add a Hidden Field per value

    In the form builder, add a Hidden Field for each value you want, and give it a label you will recognise in the entry, such as "Channel". Leave the default value empty.

  3. Enter the CSS class under Advanced

    Open the field's Advanced tab and, in CSS Classes, enter tracelead- plus the field:

    Channel        → tracelead-channel
    Source         → tracelead-source
    Campaign       → tracelead-utm_campaign
    Google click   → tracelead-gclid
    Landing page   → tracelead-landing_page

    The plugin turns the class into data-tracelead="channel" on the input, and the snippet fills it.

  4. Connect consent and send a test entry

    Choose the WordPress Consent API in Settings → TraceLead, or have your banner call TraceLead; nothing is filled before consent. Open a page with ?utm_source=test&utm_medium=cpc, accept cookies, move to the page with the form and send it.

WPForms lead source fields, and what they hold

Each Hidden Field carries one plain value, kept with the entry and passed on like any other field. Use as many or as few as you need.

Also available: utm_term, utm_content, gbraid, wbraid, Microsoft, Meta, LinkedIn, TikTok and X click ids, and optionally the last touch and the number of visits before the enquiry.

CSS class Holds
tracelead-channel The channel the first visit came from
tracelead-source Where it came from
tracelead-medium How it came
tracelead-utm_campaign The campaign name from your UTM tags
tracelead-gclid Google Ads click id, for offline conversion import
tracelead-referrer_host The site that sent the visit
tracelead-landing_page The first page seen, sensitive parameters removed
tracelead-first_touch_at When the first visit happened

Attribution without personal data. No names, emails, form values, IP addresses or user agents. Ever.

No privacy workarounds. Nothing before consent, no fingerprinting, no ad-blocker bypass, no cross-site identity.

Made in the UK. GBP pricing, UK consent rules in mind, and a person who answers email.

Questions, answered

Anything else? Email us and a person replies.

How do I put UTM parameters in a WPForms hidden field?

Add a Hidden Field and, under Advanced → CSS Classes, enter tracelead-utm_campaign (or tracelead-utm_source, tracelead-channel and so on). With the TraceLead WordPress plugin installed, the field is filled with that value from the visitor's first visit, whichever page they send the form from.

Why does my WPForms hidden field arrive empty?

A default value that reads the address, such as a query_var smart tag, only has something to read on the page the visitor landed on. Once they click through to your contact page, the UTM tags are gone. Visits from search and social never carried any.

How do I track lead source in WPForms?

Add Hidden Fields with the classes tracelead-channel, tracelead-source and tracelead-medium. Each entry then says where the lead first came from: a channel such as paid_search, organic_search, organic_social, email, referral or direct, the source (google, linkedin, newsletter, chatgpt.com) and the medium.

Can WPForms capture the gclid?

Yes. Add Hidden Fields with the classes tracelead-gclid, tracelead-gbraid and tracelead-wbraid. The Google Ads click id is kept from the first visit for the lifetime you set, 90 days by default, ready for an offline conversion import.

Can the hidden field keep its other CSS classes?

Yes. The plugin looks through the field's classes for the first one that starts with tracelead- and ignores the rest. It marks Hidden Fields only, so a tracelead- class on any other field type has no effect.

Do the values reach my CRM?

Yes, the same way any hidden field does. Map the hidden fields in your WPForms CRM or marketing integration like any other field, and the channel, source and campaign arrive on the record.

What happens before consent, or if TraceLead is unreachable?

The form submits as normal and the hidden fields stay empty. Nothing is stored or filled until your cookie banner signals consent, through the WordPress Consent API or a call to tracelead('consent', true).

Your next WPForms entry, with its source.

Install the plugin, add Hidden Fields with a tracelead- class, send a test entry.

No card needed. Cancel any time.

The whole install v1.4.0
Hidden Field → Advanced → CSS Classes
tracelead-channel
tracelead-source
tracelead-utm_campaign
tracelead-gclid