Lorixen.
EN

Tag Leads in Your CRM by the Page They Enquired From

Short answer: Add a few hidden fields to your contact form that record the page the visitor was on, the campaign values in the link they clicked and the first place they arrived from. When the form submits, the CRM stores those values as properties on the new contact. Use short, stable keys for the page rather than full web addresses, so a renamed URL does not break your reports. Keep the values for 30 days or so in a first-party cookie if you need first-touch data, and check the consent rules that apply to your site before you add it.

What you are trying to answer

The question sounds simple: which page or advert produced this lead? In practice most small businesses can answer it only for leads that fill in a "how did you hear about us" box, and most people skip that box or pick the wrong option. The better answer comes from the browser, which already knows where the visitor came from. Your job is to carry that information across the form so that it arrives in the CRM with the contact.

Two kinds of source matter. The last touch is the page the visitor was on when they submitted the form. The first touch is the page or campaign that first brought them to your site, which may have been days earlier. Store both, because they answer different questions. Last touch shows which page closes enquiries. First touch shows which campaign starts them.

Step 1: Add hidden fields to the form

A hidden field is an input that the visitor cannot see but that still submits with the form. Add one per value you want to record:

<input type="hidden" name="source_page" value="">
<input type="hidden" name="utm_source" value="">
<input type="hidden" name="utm_campaign" value="">
<input type="hidden" name="first_touch" value="">

Give each field a clear name that matches the CRM property you will create. The form does not need to know the CRM's internal names, only the names you agree on with whoever builds the integration.

Step 2: Fill the fields with a short script

A few lines of JavaScript on your pages fill the fields when the page loads. Read the campaign values from the address bar, read the page key from a value you set on the page itself, and store the first touch in a cookie:

  1. On each page, define a short key such as "pricing" or "service-kitchen". Use this key rather than the full URL, so a renamed address does not change your reports.
  2. When the page loads, read the UTM parameters from the address bar and copy them into the hidden fields.
  3. If this is the visitor's first visit, save the campaign values in a first-party cookie that lasts 30 days. On later visits, keep the saved first touch and do not overwrite it.
  4. Set the last-touch field from the page key on every page view, so the most recent page always wins.

Test the form with a link that carries sample values, such as a campaign called "spring-test". Submit the form, then check that the value arrives in the CRM contact record exactly as typed.

Step 3: Create the CRM properties

Most CRMs let you add custom properties to contacts. Create four:

Property Holds Example value
Last source page The page key on submission "pricing"
Campaign source utm_source from the link "newsletter"
Campaign name utm_campaign from the link "autumn-offer"
First touch The first campaign or referrer "google-organic"

Set the properties so they cannot be edited by hand after the lead arrives. A tag that somebody changes by mistake undoes the whole point of the record.

Step 4: Build a monthly report

Once the values arrive, the report is simple. Each month, count new leads grouped by last source page and by first touch. Compare the totals with the number of visits each page received in your analytics tool, because a page with many visits and few leads is a conversion problem, not a traffic problem.

Keep the report to one page. Two or three lines of commentary, such as "pricing page leads doubled after we moved the form higher", are more useful than a full dashboard nobody reads.

Storing campaign values and a cookie is not neutral. In the UK, the rules on cookies and similar technologies, which the Information Commissioner's Office explains on its website, generally expect consent before you store information on a visitor's device unless it is strictly necessary for the service they asked for. Whether a first-touch cookie falls inside that exception depends on your setup, so check the current guidance and your cookie banner settings rather than assuming.

Some simple habits keep you on the safe side. Do not store the full address of pages that show account or order details. Do not put names or email addresses into hidden fields. Keep the values to campaign and page keys. If a visitor refuses cookies, the form should still work, with the last-touch value only.

Common mistakes

  • Full URLs as keys. A page that moves to a new address breaks the historical comparison.
  • Overwriting first touch. If every visit writes a new first-touch value, you lose the information the field exists to keep.
  • Spaces and capitals in campaign names. "Autumn Offer" and "autumn-offer" appear as two sources. Agree on lowercase names with hyphens.
  • No test lead. Without a test submission, you may discover in a month that one field was never filled.

FAQ

Do I need a developer to do this?

Usually a developer or an integration tool is the fastest route, although some form builders can add hidden fields without code. The script is short, but it does need to run on every page that has a form.

What is the difference between last touch and first touch?

Last touch is the page that was open when the lead submitted the form. First touch is where the visitor arrived on their first visit. Keep both, because each answers a different marketing question.

Can a contact form pass the source without cookies?

Yes, for last touch. The address bar and the page key are enough for that. First touch needs a stored value, which is why consent matters.

Why not just ask leads how they found us?

You should still ask, because it captures things the browser cannot see, such as a recommendation from a friend. Use both: the automatic tag for the reliable record, and the question for the detail.

If you want the form, the CRM properties and the monthly report set up correctly from the start, tell us which form and CRM you use and we will map it with you: send us the details.

Sources

WhatsAppBook a call