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 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
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.
-
Monday
Clicks a Google ad, lands on
/pricing?utm_source=google&utm_medium=cpc&utm_campaign=brand-uk&gclid=…, leaves. -
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 | |
| 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.
-
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.
-
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.
-
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_pageThe plugin turns the class into
data-tracelead="channel"on the input, and the snippet fills it. -
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 | Example |
|---|---|---|
| tracelead-channel | The channel the first visit came from | paid_search |
| tracelead-source | Where it came from | |
| tracelead-medium | How it came | cpc |
| tracelead-utm_campaign | The campaign name from your UTM tags | brand-uk |
| tracelead-gclid | Google Ads click id, for offline conversion import | Cj0KCQjw… |
| tracelead-referrer_host | The site that sent the visit | chatgpt.com |
| tracelead-landing_page | The first page seen, sensitive parameters removed | /pricing? |
| tracelead-first_touch_at | When the first visit happened | 2026-10-05T09:14:02Z |
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.
Hidden Field → Advanced → CSS Classes
tracelead-channel
tracelead-source
tracelead-utm_campaign
tracelead-gclid