Skip to content
TraceLead

A WordPress UTM tracking plugin that fills the form your visitor finally sends

One small plugin prints the TraceLead tag, passes your cookie banner's answer to it and marks the hidden fields in your form plugin. Every enquiry then arrives with the channel, source, campaign and click id of the visitor's first visit, in Contact Form 7, WPForms, Gravity Forms or Elementor.

No card needed. No lead caps on any plan.

  • WordPress plugin, Contact Form 7, WPForms, Gravity Forms and Elementor Pro forms: Tested on every release against the builder's markup
  • How we test
Added to your WordPress form 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 lead source tracking in WordPress stops at the landing page

Most WordPress UTM recipes copy utm_source from the address bar into a hidden field. That only works if the visitor enquires on the page they landed on.

On a WordPress site they rarely do. They land on a post, open the services page, and send the form from /contact. The tags and the gclid have gone, and a visit from search or social never had any.

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 your WordPress 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

Once your banner allows it, TraceLead keeps the first visit in a first-party cookie on your own domain and fills the fields on whichever page the form is sent from. A later direct visit never overwrites it.

How to set up the WordPress UTM tracking plugin

The plugin does three things: it prints the tag, it bridges the WordPress Consent API, and it marks hidden fields in the form plugins that choose their own input names. It reads no form values and stores nothing but its settings.

The full WordPress guide
  1. Upload the plugin and paste your site ID

    Plugins → Add New → Upload Plugin, choose tracelead-wordpress.zip and activate it. Under Settings → TraceLead, paste the site ID from your dashboard (tl_…). The plugin prints the one-line tag in the footer, loaded async, with a small stub that queues calls made before it loads. It needs WordPress 6.3 and PHP 8.1 or later.

  2. Choose your consent signal

    Nothing is stored or filled until the visitor agrees. Pick one of two settings:

    • Follow the WordPress Consent API for the marketing or statistics category. Complianz and other consent plugins that implement the API switch TraceLead on page load and on every change.
    • My site calls TraceLead itself, for example from a Cookiebot or OneTrust callback:
    tracelead('consent', true);
  3. Add hidden fields in your form plugin

    One hidden field per value you want, named in the form plugin's own way (listed below): [hidden tl_channel] in Contact Form 7, the CSS class tracelead-channel in WPForms, the parameter name or field ID tl_channel in Gravity Forms and Elementor.

  4. Check it with a test visit

    Open a page with ?utm_source=test&utm_medium=cpc, accept cookies, browse to your contact page and send a test entry. For a closer look, run the line below in the browser console. In its output, attributedInputs counts the inputs the plugin marked and mappings lists the tl_ inputs found.

    tracelead.diagnostics()

WordPress form attribution in four form plugins

Each form plugin names its inputs differently, so each has its own way to mark a field. The values are the same in all four, and they reach the entry, the notification email and any CRM add-on like any other hidden field.

Another builder? If it lets you add data-tracelead="channel" to an input, or name it tl_channel, TraceLead fills it. Forms inside an iframe cannot be reached.

Field Holds
tl_channel The channel the first visit came from
tl_source Where it came from
tl_medium How it came
tl_utm_campaign The campaign name from your UTM tags
tl_gclid Google Ads click id, for offline conversion import
tl_referrer_host The site that sent the visit
tl_landing_page The first page seen, sensitive parameters removed
tl_first_touch_at When the first visit happened

Also available: utm_term, utm_content, Microsoft, Meta, LinkedIn, TikTok and X click ids, and optionally the last touch and the number of visits before the enquiry. In WPForms the class is tracelead- plus the same name.

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 track lead source in WordPress?

Install the TraceLead plugin with your site ID, connect your cookie banner and add hidden fields to your form. After consent, TraceLead keeps the first visit (UTM tags, click ids, referring site) in a first-party cookie for 90 days by default, and fills the hidden fields on whichever page the form is sent from. The lead source arrives with the enquiry, in your email and in any CRM the form plugin sends to.

Which WordPress form plugins does it work with?

Contact Form 7, WPForms, Gravity Forms and Elementor Pro forms. Each is tested against its rendered form markup on every release; the plugin has not yet been run on a live WordPress install by the TraceLead team. Any other builder that lets you set data-tracelead on an input, or name it tl_channel and so on, is filled too.

Can a WordPress form capture the gclid?

Yes. Add a hidden field for gclid (and gbraid and wbraid, Google's iOS click ids) in your form plugin's own syntax. The click id from the first visit is kept for the lifetime you set, so it is still there when the visitor enquires later from another page, ready for an offline conversion import in Google Ads.

Does it work with Complianz and other cookie banners?

Yes. In Settings → TraceLead, choose to follow the WordPress Consent API and pick the marketing or statistics category. Consent plugins that implement the API, Complianz among them, then switch TraceLead on and off as the visitor decides. Other banners can call tracelead('consent', true) themselves. Until consent, nothing is stored and the fields stay empty; the form submits either way.

Does the plugin store anything in my WordPress database?

Only its own settings: the site ID, the snippet address and the consent choice. It reads no form values, saves no entries and sends nothing from your server. The attribution is worked out in the visitor's browser and written into the hidden fields; your form plugin stores the entry as it always does.

Do I need the plugin, or can I paste the script tag?

Contact Form 7 needs only the script tag, which you can paste into your theme or Google Tag Manager. WPForms, Gravity Forms and Elementor choose their own input names, so for those the plugin marks the inputs TraceLead may fill. If you paste the tag yourself, remove it from the theme when you install the plugin so it is not loaded twice.

Does it work with page caching?

Yes. The snippet reads the address in the browser, not on the server, so full-page caches make no difference. Forms that appear later, in a pop-up or after an AJAX reload, are filled when they appear.

Your next WordPress enquiry, with its source.

Upload the plugin, paste your site ID, add the hidden fields to your form.

No card needed. Cancel any time.

The whole install v1.4.0
Settings → TraceLead
Site ID:          tl_YOUR_SITE_ID
Consent signal:   Follow the WordPress Consent API (marketing)

Contact Form 7:   [hidden tl_channel]
WPForms:          Hidden Field, CSS class tracelead-channel
Gravity Forms:    Hidden field, parameter name tl_channel
Elementor Pro:    Hidden field, ID tl_channel