Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Hidden form fields (lead source) empty: how to find and fix it

DLV-102Medium impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

A hidden field is a form input the visitor never sees. Marketers use it to store where the lead came from, such as utm_source, utm_medium, utm_campaign, gclid or a plain "lead source" value. The form sends those values to your CRM with the name and email.

Where the lead source gets lost
  1. Ad clickURL has utm_source and gclid
  2. Landing pageValues not saved anywhere
  3. Form pageHidden fields stay empty
  4. CRM recordLead source blank
  5. ReportingLead counted as direct or unknown

The break happens between the landing page and the form submit. Everything after it carries an empty value.

Why it costs you leads or sales

Leads with a known sourceExample numbers
Leads with a known source (example)Before fix: 35 %; After fix: 92 %035713592Before fixAfter fix%

Example: share of CRM leads with a filled source field before and after fixing the hidden fields. Your numbers will differ.

How to check if your site has it

Test the hidden fields by hand
  1. Open a private window with test UTMs

    Visit your landing page with ?utm_source=test&utm_medium=cpc&utm_campaign=hidden-check&gclid=abc123 added to the URL.

  2. Inspect the form

    Right-click the form, choose Inspect, and search for type="hidden". Check whether the value attributes of your UTM fields are filled.

  3. Navigate before submitting

    Click through to a second page, then to the form, the way a real visitor would. Check the fields again.

  4. Submit and check the CRM

    Submit with a test email and open the new record. Confirm each source field holds the test value, not blank.

How to fix it

Common causes and fixes
CauseSymptomFix
UTMs not savedFields filled only if the form is on the landing pageStore values in a cookie or sessionStorage on first visit
Script runs too earlyForm loads later, fields stay emptyFill fields on form load or watch for the form to appear
Name mismatchField filled on the page but blank in CRMMatch the field name or ID the form tool expects
Redirect strips parametersUTMs missing on landing pageKeep the query string in redirects
Field not mappedValue sent but CRM property emptyMap the hidden field to a CRM property
Save UTMs and fill hidden fieldsjavascript
(function () {
  var keys = ['utm_source','utm_medium','utm_campaign','utm_term','utm_content','gclid','fbclid'];
  var params = new URLSearchParams(window.location.search);
  keys.forEach(function (k) {
    var v = params.get(k);
    if (v) sessionStorage.setItem(k, v);
  });
  function fill() {
    keys.forEach(function (k) {
      var v = sessionStorage.getItem(k);
      if (!v) return;
      document.querySelectorAll('input[name="' + k + '"], input[id="' + k + '"]').forEach(function (el) {
        if (!el.value) {
          el.value = v;
          el.dispatchEvent(new Event('input', { bubbles: true }));
        }
      });
    });
  }
  fill();
  new MutationObserver(fill).observe(document.documentElement, { childList: true, subtree: true });
})();
Fix by platform
  1. Add a hidden field with a dynamic value

    Many form plugins support this. In Gravity Forms, add a Hidden field, tick Allow field to be populated dynamically and set the parameter name to utm_source. In Contact Form 7 or WPForms, use the plugin's hidden field and the script above to fill it.

  2. Load the script site-wide

    Add the snippet through a header and footer plugin or your child theme so it runs on every page, not only the form page.

  3. Map the field

    In the CRM integration settings, map each hidden field to a CRM property.

Hidden field behaviour

Before

  • UTMs read only on the landing page
  • Form loads after the script runs
  • CRM source field blank or 'Direct'

After

  • UTMs saved on first visit
  • Fields filled when the form appears
  • CRM shows source, medium and campaign

How to confirm it's fixed

Confirmation checklist
  • Visiting with test UTMs fills the hidden fields in the page inspector
  • The values are still there after clicking to another page
  • A test submission creates a CRM record with source, medium and campaign filled
  • The test works on mobile as well as desktop
  • Forms in popups and embeds are filled too
  • A visit without UTMs leaves the fields blank or on your chosen default

How to prevent it happening again

Prevention habits
  • Keep one documented list of hidden field names and the CRM properties they map to
  • Re-test after any change to forms, themes, consent banners or redirects
  • Add the script in one place only, so it isn't duplicated or removed by accident
  • Keep query strings on redirects and short links
  • Review the CRM for blank source values every month
  • Schedule an automated test submission with UTMs

How FunnelGuard handles this

Questions people ask

Why are my hidden form fields empty?

The most common reasons are that the UTMs were never saved after the landing page, the script ran before the form loaded, or the field name doesn't match. Check the page inspector to see whether the value is set before you submit.

Why is my UTM hidden field not populating?

The script usually can't find the field, or the visitor reached the form on a different page where the URL no longer has UTMs. Save the values in sessionStorage or a cookie on the first page and fill the fields when the form appears.

How do I capture UTM parameters in a hidden form field?

Add a hidden input for each parameter, read the values from the URL with JavaScript, store them, and write them into the inputs. Then map each field to a property in your CRM.

Why does the lead source show as Direct in my CRM?

Direct often means no source value arrived. UTMs may have been stripped by a redirect, lost between pages, or never written to the hidden field. Test with a tagged URL and check each step.

Do hidden fields work in popups and embedded forms?

Only if the script fills them after the form loads. Popups and iframes appear later or live in a separate document, so use a MutationObserver or the form tool's own hidden field setting.

Why is gclid empty in my form submissions?

The gclid only exists on the first landing URL after an ad click. If you don't store it, it is gone by the time the visitor reaches the form. Save it on arrival and fill a hidden field from storage.

How can I test hidden form fields without waiting for real leads?

Open your page with test UTMs, fill the form with a test email and check the CRM record. An automated check such as FunnelGuard's UTM persistence test can repeat this on a schedule.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: UTM persistence into hidden fields.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.