Skip to content

How to Track Lead Source in Salesforce

Website analytics can show where visitors arrived from, but that insight is only useful for marketing decisions when it travels with the lead into Salesforce. A structured setup connects the first visit, the form submission, and the eventual opportunity or customer record, so reporting can distinguish organic search, paid search, paid social, and other channels instead of relying on a manually entered source.

Four-step setup

Install the attribution snippet on the website, either directly through site settings or through a tag manager. Next, add hidden fields to each lead-capture form. The core field set is Channel, Channel Drilldown 1, Channel Drilldown 2, Channel Drilldown 3, and Channel Drilldown 4. Most form builders provide a hidden-field type or let an ordinary field be hidden in its settings.

Checklist before launch:

  • Snippet present on pages that lead to the form
  • Every capture form contains the five channel fields
  • Field names in the form match the names expected downstream
  • A test submission creates a Salesforce record with channel values populated
  • UTM conventions are consistent across campaigns that should roll up together

How the data moves from visit to CRM

On arrival, the tool examines the same kinds of technical signals used by website analytics, classifies the visit into a channel such as Organic Search, Paid Search, or Paid Social, and stores that classification in a cookie. When the visitor later submits a form, the stored values are written into the hidden fields and submitted alongside name, email, and other contact details. The form tool then passes the complete record to Salesforce, including through Web to Lead forms where applicable.

What to capture: channel and landing page

Two kinds of detail matter. Channel data gives the broad source plus drilldowns: for Paid Search, campaign, ad group, and keyword-level detail can be carried through UTM parameters. Landing-page data records the first page seen and its category, such as a blog, so content performance can be reported in aggregate and by individual page.

Worked example — paid search: Channel = Paid Search; Channel Drilldown 1 = Google; Channel Drilldown 2 = Brand Campaign; Channel Drilldown 3 = Free-trial ad. The same visitor arriving organically would instead be recorded as Channel = Organic Search, with Google as the first drilldown, the referring Google domain as the second, and the search keyword where available as the third. Comparing those two records in Salesforce makes the paid-versus-organic distinction explicit without opening a separate analytics tool.

Reports to build first

Once the fields are in Salesforce, report with Salesforce reports, Tableau, or another BI tool. Three useful starting views are:

  • Leads by channel: a high-level count per channel to spot where volume comes from and whether budget matches the strongest source.
  • Opportunities by Google Ads campaign: monthly opportunity counts coloured by campaign, to identify campaigns producing pipeline rather than only clicks or leads.
  • Customers by Facebook Ads network: customer counts split across Facebook, Instagram, Messenger, and WhatsApp placements, to see which network drives closed business.

Also track conversion rate to opportunity and Closed/Won deals by channel, so spend decisions reflect downstream value, not just lead volume.

Failure distinctions to avoid

A common failure is treating a manually selected Lead Source value as equivalent to captured attribution. Manual entry depends on memory and consistency, while hidden-field capture preserves the channel, drilldowns, and landing page at submission time. Another failure is adding hidden fields to only one form; any form without them will create Salesforce records that cannot be compared with captured records. Finally, inconsistent UTM naming breaks drilldown reporting even when capture works, so standardise campaign and keyword values before scaling the setup.

Frequently asked questions

What is the shortest setup sequence for tracking lead source in Salesforce?

Add the tracking snippet to your website, add Channel and Channel Drilldown hidden fields to your lead-capture forms, let the tool populate those fields on submission, and confirm the values arrive in Salesforce with the lead's contact details. Then build reports from the stored channel and landing-page data.