HubSpot integration

Lead source in HubSpot.

HubSpot says “Paid Search.” Capture the actual campaign, ad, and page journey on every form.

Works with all HubSpot form types No workflows or operations hub required Free tier · no card

Why HubSpot’s Lead Source field is often wrong, and how to fix it

HubSpot has two source properties. Original Source records a contact’s earliest tracked visit; Latest Source is overwritten on every new session. Many reports default to Latest Source, so a lead who first arrived from Paid Search but later returns via a bookmark is recorded as Direct, and the original source is lost.

HubSpot files a visit as Direct whenever it cannot see where it came from. Per HubSpot’s own documentation, that happens when:

  • the referring site uses HTTPS but yours does not, so the referrer is dropped;
  • Safari on iOS 18.7+ strips utm_source, utm_medium and gclid from the URL before HubSpot’s script can read them;
  • a visitor declines the cookie banner, or the form sits on a page without the HubSpot tracking code;
  • the click came from an app, message, or email that carried no referrer.

The result: a share of your “Paid Search” and “Organic” leads quietly land in Direct, and your reporting under-credits the channels that are actually working.

How Lead Source fixes it: one snippet captures the real source, campaign, and full page journey on every form submission, server-side, and writes it to a custom HubSpot property alongside HubSpot’s own Original Source. You keep HubSpot’s fields and gain the source it could not see.

Why lead sources get mislabelled in the first place →

Works with every HubSpot form type.

HubSpot forms, pop-ups, embedded forms, non-HubSpot forms tracked via the tracking code, and standalone landing pages all work. Free, Starter, Professional, and Enterprise tiers. No Operations Hub or workflows required.

The HubSpot Original Source problem

Nine values for everything you spend on marketing.

HubSpot’s built-in Original Source is a high-level bucket. It’s the right answer for “how did this contact first find us, in general?” It’s the wrong answer for “which of my Google Ads campaigns produced this customer?”

What HubSpot Original Source shows
What Lead Source shows
Paid Search
Google Ads · Local Services Sydney · managed-it-sydney-exact
Organic Search
Organic Google · “managed it services sydney” · /managed-it
Social Media
LinkedIn · Sponsored Post: 5 ways to cut IT costs
Direct Traffic
Direct · landed /pricing · full page journey captured
Email Marketing
Email · April newsletter · cta: book a call

Original Source tells you a category. Lead Source tells you which specific campaign produced a customer. Which is what you need to make a budget decision.

How it actually works

One snippet on your site. One custom property in HubSpot.

  1. 01
    Lead Source captures the visitor’s real source, campaign, and page journey when they land. Before HubSpot’s tracking code even sees them. UTMs, referrer, ad click ID, landing page.
  2. 02
    When the visitor submits any HubSpot form, the source data is sent to HubSpot via the Forms API alongside the form fields. Written to a custom contact property (we recommend leadsource_campaign).
  3. 03
    Original Source stays as HubSpot wrote it. leadsource_campaign stays as Lead Source wrote it. Two fields, two purposes, no overwrite conflicts.
  4. 04
    Source data survives lifecycle changes, MQL transitions, deal stages, and contact merges. Because it lives in a property HubSpot workflows don’t touch by default.
The snippet

One line, before the closing </head>.

<script async src="https://cdn.leadsource.co/track.js" data-site-id="YOUR_SITE_ID" data-hubspot-portal="YOUR_PORTAL_ID"></script>

Set data-hubspot-portal to your HubSpot Portal ID. Lead Source auto-detects HubSpot forms on the page and binds the source data on submission. No form-by-form configuration.

Three-step install

Done in five minutes.

01

Add the snippet to your site

Paste the script tag above before the closing </head> on any page that has a HubSpot form. If your site is built in HubSpot CMS, drop it in Settings › Website › Pages › Site Header HTML.

02

Create the custom property

In HubSpot, go to Settings › Properties › Contact properties. Create a single-line text property called leadsource_campaign. That’s where the campaign-level source lands on every submission.

03

Submit a test form

Open one of your forms with a UTM in the URL (e.g. ?utm_source=google&utm_campaign=test) and submit. The new contact in HubSpot will have leadsource_campaign populated with the real source. Alongside HubSpot’s Original Source.

Common questions

Questions, answered.

Doesn't HubSpot already track lead source?

HubSpot tracks Original Source. A high-level bucket like "Paid Search" or "Direct Traffic." Useful for general reporting. Not useful for deciding whether to keep funding a specific Google Ads campaign. Lead Source adds the campaign-level detail HubSpot doesn't capture by default.

Will this overwrite HubSpot's Original Source field?

No. We write to a separate custom property (recommended: leadsource_campaign). HubSpot's Original Source stays untouched. Both fields exist on the same contact record. You can use either or both in reports, lists, and workflows.

Do I need Operations Hub or Marketing Hub Professional?

No. The install works on any HubSpot tier including Free. We use the standard Forms API to write the property. No workflows, no Operations Hub data sync required.

What about non-HubSpot forms on a HubSpot-tracked site?

Lead Source works on any form, not just HubSpot's. If you have a Typeform or Wix form on a HubSpot-tracked page, we still capture and forward the source. We can post the contact and source data to HubSpot via the Forms API even when the form itself isn't a HubSpot form.

Does the source survive contact merges and lifecycle changes?

Yes. leadsource_campaign is a regular contact property. Merge logic and lifecycle workflows in HubSpot leave it alone unless you explicitly write a workflow that touches it. Original Source can shift on activity; leadsource_campaign reflects what was captured at the moment of the form submission.

See your real HubSpot lead sources.

Free. Five-minute install. No credit card.

Start free

Free to start &middot; no card