Google Tag Manager UTM tracking in one tag, not a cookie recipe
Add TraceLead to your container as one Custom HTML tag, or import it, and add hidden fields to your forms. It keeps the first visit's UTM tags, click ids and referrer and fills the fields when the visitor enquires, on whichever page that is.
No card needed. No lead caps on any plan.
- Google Tag Manager: 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
Persist UTM parameters in GTM without building it yourself
The usual GTM recipe has three parts: a tag that copies the UTM parameters into a cookie, a variable for each value, and a Custom HTML tag that writes them into the form. Every rule is yours to write and keep: which parameters, for how long, whether a later visit may replace the first, and when consent allows the cookie at all.
And it only knows what was in the URL. Visits from Google search, social posts and links on other sites usually carry no UTM tags, so they arrive blank unless you also classify the referrer.
-
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 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 does all of it in the one tag: it keeps the first visit in a first-party cookie once consent allows, classifies untagged visits by click id and referrer, never lets a direct return overwrite a campaign, and fills the fields on any page.
How to add UTM tracking with Google Tag Manager
Three steps in GTM and one on your forms. Nothing changes for the visitor filling in the form.
The full Google Tag Manager guide-
Add the Custom HTML tag, or import the container
In TraceLead, open Install the snippet, switch step 1 to Google Tag Manager and copy the code, which already holds your site ID. In GTM, go to Tags → New → Tag Configuration → Custom HTML, paste it and trigger it on All Pages (or Initialization - All Pages to load it earlier).
Prefer an import? Download the container export and use Admin → Import Container with Merge and Rename conflicting tags, then set the TraceLead site ID variable to your site's public ID.
-
Signal consent
The tag only loads the snippet; nothing is stored until consent. Pick your consent manager as the site's preset in TraceLead, or add a second Custom HTML tag fired by your consent manager's trigger for the marketing category:
<script>window.tracelead('consent', true);</script>With Google Consent Mode, open that tag's Advanced Settings → Consent Settings, choose Require additional consent for tag to fire and add
ad_storage. -
Add hidden fields to your forms
Add a hidden input for each value you want, named
tl_plus the field:<input type="hidden" name="tl_channel"> <input type="hidden" name="tl_source"> <input type="hidden" name="tl_utm_campaign"> <input type="hidden" name="tl_gclid"> -
Preview, publish and check
Preview with Tag Assistant: the tag should fire once per page. Submit and publish the container, open your site with
?utm_source=test&utm_medium=cpc, accept the banner and runtracelead('diagnostics', console.log)in the console to seeconsent: trueand each mapping's match count.
GTM lead source tracking: what arrives with each lead
Pick the fields you want; leave out the rest. They reach your inbox or CRM with the form, as plain values you can sort and filter.
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.
| Hidden input name | Holds | Example |
|---|---|---|
| tl_channel | The channel the first visit came from | paid_search |
| tl_source | Where it came from | |
| tl_medium | How it came | cpc |
| tl_utm_campaign | The campaign name from your UTM tags | brand-uk |
| tl_gclid | Google Ads click id, for offline conversion import | Cj0KCQjw… |
| tl_referrer_host | The site that sent the visit | chatgpt.com |
| tl_landing_page | The first page seen, sensitive parameters removed | /pricing? |
| tl_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 persist UTM parameters with GTM?
Load TraceLead through one Custom HTML tag. After consent it keeps the first visit's UTM tags, click ids and referrer in a first-party cookie on your domain for the lifetime you set, 90 days by default, and fills your hidden form fields on any later page. No cookie variables or extra tags to maintain.
Can GTM fill hidden form fields with UTM parameters?
TraceLead does it from inside your container. Add hidden inputs named tl_channel, tl_utm_campaign and so on to your form; the snippet fills them, including forms that appear after the page has loaded.
How do I track lead source with Google Tag Manager?
Install the TraceLead tag, add a tl_channel and a tl_source hidden input to your form, and signal consent. Visits without UTM tags are still classified from the click id or the referrer: a Google search arrives as google / organic, a ChatGPT link usually as chatgpt.com / referral, a typed address as direct.
Does it matter that GTM fires the tag after the page has loaded?
No. Each release is tested by injecting the tag after load, the way GTM does, then signalling consent and sending a form. The tag also loads the snippet only once per page, even if it fires twice.
How do I signal consent from Google Tag Manager?
Use a second Custom HTML tag that calls tracelead('consent', true), fired by your consent manager's trigger; with Google Consent Mode, require ad_storage in the tag's consent settings. Or pick your consent manager, including Google Consent Mode, as the site's preset in TraceLead and add no consent tag at all.
Should the loader tag itself require consent?
Usually not. The loader stores nothing by itself, and if it waits for consent the dashboard misses visitors who accept later on the same page. Keep TraceLead's consent mode on Explicit and let the consent signal do the gating.
What does the tag need from my Content Security Policy?
The snippet's origin in script-src and the TraceLead API in connect-src. GTM's Custom HTML tags already need your policy to allow GTM's inline execution, usually with a nonce.
One tag in your container. The source on your next lead.
Import the container or paste the Custom HTML tag, signal consent and add the hidden fields. Then publish.
No card needed. Cancel any time.
GTM → Tags → New → Custom HTML (All Pages)
<!-- TraceLead: paste the tag from Install the snippet -->
Consent tag (your CMP's marketing trigger):
<script>window.tracelead('consent', true);</script>
On your forms:
<input type="hidden" name="tl_channel">
<input type="hidden" name="tl_utm_campaign">