On this page
What this issue is
A hidden field is a form input the visitor cannot see. Marketers add hidden fields named utm_source, utm_medium, utm_campaign, utm_term and utm_content so the form sends campaign data to the CRM along with the name and email.
The issue is that the fields exist but nothing fills them. The form submits fine, the lead is created, and the UTM columns are blank. Because nothing visibly breaks, this often goes unnoticed for months.
Common causes: no script copies the URL values into the fields; the field name does not match the parameter; the visitor moved to a second page and the UTMs left the URL; the form loads after the script ran (popups, iframes, multi-step forms); or a redirect stripped the UTMs before the page loaded.
Why it costs you leads or sales
The lead is not lost, but its origin is. Without UTMs in the CRM you cannot tell which campaign produced which lead, let alone which revenue. Budget decisions then rest on guesses, and good campaigns look weak while poor ones look fine.
It also breaks automation. Lead routing, source-based nurture emails and offline conversion uploads to ad platforms all depend on those fields being filled.
- Ad clickURL has utm_source=google
- Landing pageUTMs are in the address bar
- Hidden fieldsNothing copies the values in
- Form submitFields sent empty
- CRM contactSource columns blank
The ad click carries UTMs, but the hidden fields are never filled, so the CRM record has no source.
Example: share of 100 paid leads in the CRM that carry a utm_campaign value, before and after the fix.
How to check if your site has it
Open the page with UTMs
Visit your landing page in a private window with ?utm_source=test&utm_medium=cpc&utm_campaign=hidden_check added to the URL.
Inspect the hidden fields
Right-click the form, choose Inspect, and search for type="hidden" or the name utm_source. Check whether the value attribute holds 'test'.
Submit a test lead
Use a clearly fake name and your own email, then open the new contact in your CRM.
Compare
If the UTM fields in the CRM are empty, the issue is present. Repeat after clicking to a second page, then the form, to test persistence.
document.querySelectorAll('input[type=hidden]').forEach(function (el) {
if (/utm|gclid|fbclid/i.test(el.name)) {
console.log(el.name, '=', JSON.stringify(el.value));
}
});How to fix it
The principle is the same everywhere: capture UTMs on the first page, store them, and fill the fields once the form exists. Make sure the field name matches what your CRM mapping expects.
Use your form plugin's feature
Gravity Forms: tick 'Allow field to be populated dynamically' and set the parameter name to utm_source. WPForms: add a Hidden Field and use the smart tag {query_var key="utm_source"}. Contact Form 7 needs a small script or a hidden-field add-on.
Persist across pages
Query-string smart tags only work on the landing page. Add the script from the Custom code tab in a header snippet so values survive navigation.
Create variables
Add URL variables of type Query for utm_source, utm_medium, utm_campaign, utm_term and utm_content.
Add a Custom HTML tag
Fire on All Pages (and on form render events for popups). Use the script from the Custom code tab, reading values from cookies if the URL has none.
Add hidden inputs
Add an embed inside the form with <input type="hidden" name="utm_source" id="utm_source"> for each parameter.
Add the script
Paste the Custom code script in Project Settings > Custom Code > Footer Code, then publish.
Add hidden fields
In the form builder, add Hidden Field elements and set the query key to utm_source and so on, then map them to contact custom fields.
Test with a URL
Open the form link with UTMs added and check the contact record. If the form is embedded, pass UTMs to the embed URL or add a script to the host page.
Capture, store and fill
Use the script below. It saves UTMs on first sight, keeps them for 30 days, and fills every matching hidden field, including forms added later.
(function () {
var keys = ['utm_source','utm_medium','utm_campaign','utm_term','utm_content'];
var params = new URLSearchParams(window.location.search);
keys.forEach(function (k) {
var v = params.get(k);
if (v) {
document.cookie = k + '=' + encodeURIComponent(v) + ';path=/;max-age=2592000;SameSite=Lax';
}
});
function read(k) {
var m = document.cookie.match(new RegExp('(?:^|; )' + k + '=([^;]*)'));
return m ? decodeURIComponent(m[1]) : '';
}
function fill() {
keys.forEach(function (k) {
document.querySelectorAll('input[name="' + k + '"]').forEach(function (el) {
if (!el.value) el.value = read(k);
});
});
}
document.addEventListener('DOMContentLoaded', fill);
new MutationObserver(fill).observe(document.documentElement, { childList: true, subtree: true });
})();How to confirm it's fixed
- Open the landing page with test UTMs and see values in the hidden fields via Inspect
- Submit a test lead and find all five UTM values on the CRM contact
- Repeat after visiting a second page before the form
- Repeat with a popup or multi-step form if you use one
- Test on mobile and in a fresh private window
- Visit without UTMs and confirm the form still submits
How to prevent it happening again
- Keep one documented list of hidden field names used on every form
- Retest after changing form plugins, themes, or the CRM mapping
- Test new landing pages and popups with UTMs before launching campaigns
- Check that redirects keep query strings
- Review the share of CRM leads with a blank source each month
How FunnelGuard handles this
FunnelGuard detects this issue today. A robot visitor runs your real lead form journey on a schedule, arriving with marked test UTMs, and checks that the hidden UTM fields carry values when the form is submitted. It can also check whether the test lead reaches your inbox and CRM.
If a failure appears, it is re-checked from a second region before one alert goes out with a screenshot and a likely cause. The Free plan covers 1 site and 2 journeys with daily checks and no card, and paid plans have a 3-day free trial.
Questions people ask
Why are my hidden UTM fields empty in my CRM?
Usually nothing copies the URL parameters into the hidden fields. Other causes are mismatched field names, UTMs lost when the visitor changes page, a form that loads after your script runs, or a redirect that strips the query string.
How do I populate hidden UTM fields on a form?
Read the UTM parameters from the URL on landing, store them in a cookie or sessionStorage, and write them into inputs named utm_source, utm_medium and so on. Many form builders have a built-in option for this, such as dynamic population in Gravity Forms.
Why do UTMs disappear when someone visits a second page?
UTMs live only in the landing page URL. Internal links usually do not carry them, so unless you stored the values in a cookie or sessionStorage, the form on page two has nothing to read.
How can I test whether my hidden fields are being filled?
Open the page with test UTMs in the URL, right-click the form and choose Inspect, then check the value of each hidden input. Submit a test lead and confirm the values appear on the CRM contact.
Do hidden UTM fields work with popup or multi-step forms?
Only if the script fills fields after the form appears. A script that runs once on page load misses forms added later, so use an observer or trigger the fill when the popup opens.
Is the field name important for hidden UTM fields?
Yes. The name must match the parameter your script or form builder looks for, and the CRM field must be mapped to it. A mismatch in spelling or case leaves the value blank.
Can FunnelGuard tell me if my hidden UTM fields are empty?
Yes. FunnelGuard runs your lead form with marked test UTMs on a schedule and checks that the hidden fields carry values on submit. It alerts you with a screenshot and a likely cause if they do not.
Related issues
- TRK-270UTMs not written to CRM contact fieldsFix guide
- TRK-271gclid/fbclid not written to CRMFix guide
- TRK-277Lead source field overwritten on later visitsFix guide
- TRK-279Hidden fields populated with literal placeholders ({utm_source})Fix guide
- TRK-280First-touch vs last-touch UTM fields swappedFix guide
- TRK-272GoHighLevel attribution source missing on contactFix guide