Skip to content

Implementation: Lead Source Capture

Capture the real lead source with hidden fields.

Your form asks for a name, an email, a phone number. It should also silently record where that person actually came from, before anyone types a single character. This workflow builds that capture, plus the fallback for the visits where it can't work.

  • $0 setup, month to month
  • 30-day guarantee, pay only if satisfied
  • Free proposal within 1 business day

What this workflow covers

The field map, the cookie, and the quiet failure modes.

The field map

A short script reads the page's query string on load and writes the values into hidden input fields named to match your CRM's fields exactly: source, medium, campaign, content, term, click ID, and the referring page. Those hidden fields submit alongside the visible ones, so nothing needs re-mapping once the form posts.

First touch versus last touch

A cookie set on the very first visit can preserve the original source even when someone returns later through a different channel and finally submits the form then. Without that cookie, the hidden fields only ever capture the most recent visit's parameters, quietly overwriting whichever campaign actually built the original interest.

Where the data enters

The hidden fields populate before the person touches the visible form, then travel with the rest of the page's normal form submission straight into the CRM's matching custom fields. No separate import step and no manual tagging by a rep after the fact.

How failures surface

Ad blockers and privacy browsers that restrict tracking scripts or third-party cookies can leave hidden fields blank, and a form embedded through an iframe on a second domain can lose the parent page's parameters entirely. Neither failure throws an error. Both show up later as an unexplained spike in leads with no recorded source.

Where this quietly stops working.

Cookie lifespan has to match the sales cycle

Safari's tracking prevention shortens cookies set by page scripts to about a week. A first-touch cookie built to that limit will not survive a buyer who researches for a month before requesting a quote, and the original source silently reverts to whatever channel brought the later visit. Longer research cycles need a server-side fallback, not just a longer cookie.

Field names have to match exactly

If the CRM's custom field key differs from the hidden input's name attribute, even by case or a hyphen where the CRM expects an underscore, the value still submits but never lands anywhere visible. Nobody notices until someone tries to run a report by source and finds the field empty across the board.

Bots fill in hidden fields too

A hidden field will happily record a clean source and campaign for a submission generated by a scraping bot or a competitor testing your form, not just a genuine buyer. Raw source counts from the form always need a spam filter layered on top, separate from the tagging itself.

We test against real ad blockers before shipping

Before this goes live, we submit the form through a browser running a common ad blocker and a privacy mode and confirm exactly what lands in the CRM. The failure mode here is quiet: the form still submits fine, it just arrives with blank source fields, and that's easy to miss without a deliberate test.

How we set it up.

01

Map the fields

We confirm which custom fields already exist in your CRM for source data, match hidden input names to them exactly, and add any missing fields before writing a line of the capture script.

02

Build and test capture

We add the page-load script, set the first-touch cookie, and submit test leads from several traffic sources to confirm each one lands in the CRM correctly tagged.

03

Set the fallback rule

We decide what a lead with no captured source gets labeled inside the CRM, so unknown-source leads stay visible in reporting instead of disappearing into a field nobody checks.

Hidden field lead source capture FAQ.

Stop losing lead source data before the form even loads.

We'll check what your current form actually captures, add the hidden fields and the first-touch cookie your CRM is missing, and test it against the ad blockers real visitors already run.

Keep exploring:

All implementation workflowsUTM to CRM field mappingDuplicate lead dedupe rulesGet a free proposal