Skip to content
TraceLead

Salesforce Web-to-Lead UTM tracking, in custom fields beside Lead Source

Create a few custom fields on the Lead, put them in your Web-to-Lead form as hidden inputs, and TraceLead fills them with where the visitor first came from: the Google ad, the newsletter, the search, the referral. Salesforce stores the channel, campaign and click id on the lead, next to what the visitor typed.

No card needed. No lead caps on any plan.

  • Salesforce Web-to-Lead: Documented pattern, not covered by an automated test
  • How we test
Added to your Salesforce lead Sample data

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
Arrived from

Salesforce lead source tracking: why the picklist is not enough

Lead Source is one picklist value per lead. Every enquiry from your website tends to arrive as the same choice, with no room for the campaign, the keyword, the click id or the page the visitor first read.

The usual fix, a script that copies utm_source from the address bar into the form, only works when the visitor enquires on the page they landed on. Most land on a blog post or a pricing page and send the form later from /contact, when the tags are gone.

Two visits, one enquiry Sample data
  1. Monday Clicks a Google ad, lands on /pricing?utm_source=google&utm_medium=cpc&utm_campaign=brand-uk&gclid=…, leaves.
  2. Thursday Types your address, opens /contact, sends the Web-to-Lead form.
Hidden field Read from the URL Filled by TraceLead
tl_channel empty paid_search
tl_source empty google
tl_utm_campaign empty brand-uk
tl_gclid empty Cj0KCQjw…
tl_landing_page /contact /pricing?utm_source=google&utm_medium=cpc

TraceLead keeps the first visit in a first-party cookie on your own domain once your banner allows it, and fills the Web-to-Lead inputs on whichever page the form is sent from. The table uses tl_ names for clarity; in Salesforce each input is named by its 00N id.

How to capture UTM parameters in Salesforce Web-to-Lead

Four steps in Setup and one in TraceLead. You need permission to create fields and Web-to-Lead forms in your org.

The full Salesforce guide
  1. Create the custom fields on Lead

    In Setup, open Object Manager → Lead → Fields & Relationships → New, choose Text (255) and create TraceLead channel, TraceLead source, TraceLead campaign and the others you want. To keep them after conversion, create the same fields on Contact or Opportunity and map them under Map Lead Fields.

  2. Generate the Web-to-Lead form

    Open Setup → Web-to-Lead → Create Web-to-Lead Form, add the new fields and generate the HTML. Each custom field appears as an input named by its id, starting 00N:

    <input id="00N5g00000AbCdE" maxlength="255"
           name="00N5g00000AbCdE" size="20" type="text" />
  3. Hide the TraceLead inputs

    Change each TraceLead input's type="text" to type="hidden" and delete its label, then publish the form on your page next to the TraceLead tag:

    <input id="00N5g00000AbCdE" maxlength="255"
           name="00N5g00000AbCdE" type="hidden" />
  4. Paste the 00N ids into the Salesforce preset

    On your site's page in TraceLead, choose Start from a preset → Salesforce Web-to-Lead and paste each id next to its field. TraceLead checks that every id starts with 00N and has 15 to 18 characters, then writes a mapping such as input[name="00N5g00000AbCdE"]. You can edit or remove each row afterwards.

  5. Connect your cookie banner and send a test lead

    Nothing is stored or filled until the visitor agrees, so pick your consent manager in TraceLead or call tracelead('consent', true) from your banner. Then visit with ?utm_source=test&utm_medium=cpc, accept, browse to the form, send it and open the new lead.

What arrives on the Salesforce lead record

The Salesforce preset covers these eight fields. Each is a plain text value you can put in list views, reports and assignment rules.

Want the gclid for offline conversion import, utm_term or the referring site? Create the field the same way and add a mapping row for it by hand under the site's attribution settings.

Lead field, Text (255) Holds
TraceLead channel The channel the first visit came from
TraceLead source Where it came from
TraceLead medium How it came
TraceLead utm source The utm_source on the first visit
TraceLead utm medium The utm_medium on the first visit
TraceLead utm campaign The campaign name from your UTM tags
TraceLead landing page The first page seen, sensitive parameters removed
TraceLead first touch at When the first visit happened

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.

Can Salesforce Web-to-Lead capture UTM parameters?

Only if the form carries an input for each one and something fills it. Create a Text (255) custom field per value on the Lead, add it to the Web-to-Lead form, change the input to type="hidden", and TraceLead fills it with the first visit's campaign, source and channel when the visitor sends the form.

Why not just use the Lead Source field?

Lead Source is a single picklist value, so every form enquiry tends to land as the same choice. It cannot hold the campaign name, the gclid or the page the visitor first saw. Keep using it for your own categories, and put the detail in custom fields beside it.

Where do I find the 00N id of a custom field?

Generate the form under Setup, Web-to-Lead, Create Web-to-Lead Form with your new fields ticked. In the HTML, each custom field is an input whose name is its id, starting 00N. Paste that id next to its field in the Salesforce Web-to-Lead preset.

Do the values stay on the record when a lead is converted?

Only if you map them. Create the same fields on Contact or Opportunity and map each one under Lead, Fields & Relationships, Map Lead Fields. Salesforce copies the values on conversion; TraceLead plays no part in it.

Does TraceLead connect to my Salesforce org?

No. TraceLead keeps no Salesforce credentials and never writes to Salesforce. The snippet fills the hidden inputs in your page, and your Web-to-Lead form sends them to Salesforce with the rest of the enquiry.

What happens before a visitor accepts cookies?

Nothing is stored and the hidden inputs stay empty until your consent banner says yes. The form still posts to Salesforce, just without the attribution for that lead.

Is this tested against Salesforce?

The snippet's side, filling named hidden inputs on your page, is tested on every release. How Salesforce stores the submission is not, which is why this is a documented setup and the status above says so.

Your next Web-to-Lead lead, with its campaign on the record.

Create the custom fields, hide them in the generated form, paste the 00N ids. Then send a test lead.

No card needed. Cancel any time.

The whole install v1.4.0
<!-- In the generated Web-to-Lead HTML -->
<input id="00N5g00000AbCdE" maxlength="255"
       name="00N5g00000AbCdE" type="hidden" />

TraceLead → Start from a preset → Salesforce Web-to-Lead
channel: 00N5g00000AbCdE
source:  00N5g00000AbCdF