Skip to main content
HubSpot → PostHogIntegration guide

Connecting HubSpot to PostHog

HubSpot knows which leads turned into money, weeks after the ad platforms have stopped paying attention. PostHog can be self-hosted, which changes the calculus entirely: the data stays on infrastructure you control, and so does the responsibility for everything that goes wrong with it. The join between them succeeds or fails on one thing: whether the distinct_id reaches the HubSpot contact and deal before the conversion happens, because PostHog can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

HubSpot Closed Won deals on the same PostHog person

Write PostHog's distinct_id, usually your user ID, to a HubSpot contact property at signup or demo request. On Closed Won, capture a deal_won event through the capture API with that distinct_id, amount, deal ID and real close timestamp, attaching the company group for B2B. PostHog's data warehouse HubSpot source is an alternative that handles reopened deals.

PostHog holds the product behavior and HubSpot holds the money; the join is PostHog's distinct_id. Write it to a HubSpot contact property when the person signs up or submits the demo form, and make sure PostHog's identify call after login uses the same ID your app stores, usually your user ID, so the anonymous browsing and the trial activity land on one person.

When the deal reaches Closed Won, capture an event such as deal_won through the capture API with that distinct_id, the amount, the HubSpot deal ID and the real close timestamp. If you use PostHog group analytics, attach the company as well, since a B2B deal belongs to the account rather than to whichever user clicked the ad. That gives you the funnel neither tool draws alone: which in-product actions during the trial preceded deals that actually closed.

Check whether PostHog's data warehouse HubSpot source suits you better than events. It syncs deals and contacts as tables you can join in SQL, which handles lost and reopened deals without any retraction logic. The event route breaks when sales creates the deal on a contact who never touched the product, the economic buyer rather than the trial user, so deal_won lands on a person with no history. Sending it to the company group too keeps the funnel intact.

HubSpot → PostHog · what breaks

Why this join usually fails — HubSpot → PostHog

  1. 01

    The distinct_id never reaches HubSpot

    The identifier has to be captured on the form and written to a contact property. HubSpot forms embedded in an iframe do not automatically see your page's cookies, so a hidden field has to be populated deliberately. Miss that and the contact is created clean, with nothing to join on ever again.

  2. 02

    The deal closes long after the click

    B2B sales cycles routinely run past the attribution window of every ad platform. Value uploaded on day 95 is value nobody will accept, so the timing question has to be answered before anything is built.

  3. 03

    Self-hosting the analytics and the outage together

    The advantage of owning the pipeline is that nothing blocks it. The cost is that when the ingestion instance fills its disk on a Saturday, the events are gone and nobody is paged. Hosted tools fail differently and more visibly.

  4. 04

    Nothing reconciles afterwards

    PostHog shows events in the activity view within moments. On a self-hosted instance, check the ingestion lag as well — events that are queued are not events that are lost, and the two need different responses.

HubSpot → PostHog · the fix

What working looks like — HubSpot → PostHog

  • The distinct_id on every deal

  • Conversions arriving in PostHog

    The event lands on the person profile and becomes available in insights, funnels and session replay.

  • Reconciled against the source

HubSpot → PostHog · architecture

How HubSpot and PostHog actually connect

  1. 1

    HubSpot holds the truth

    The deal carries the amount, the stage, the close date and the associated contact. That contact is where the original click identifier must live, because the deal is created much later by a salesperson who has no idea an ad was involved.

  2. 2

    PostHog needs a click to match

    PostHog needs a distinct_id, an event name and its properties. Self-hosted instances additionally need the ingestion endpoint reachable and the project API key correct, which is a class of failure hosted tools do not have.

  3. 3

    The identifier is the bridge

    The distinct_id, captured at the visit and carried into the HubSpot contact and deal.

  4. 4

    The event source decides reliability

    Trigger when the deal reaches Closed Won and send the deal amount with the identifier stored on the associated contact. Sending on form submission instead means you optimize toward form fills, which is exactly the behavior that fills a pipeline with unqualified leads.

  5. 5

    Deduplication at the destination

    PostHog deduplicates on the event UUID where supplied. Without one, a retried batch duplicates, and on a self-hosted instance there is no vendor support desk to notice it for you.

HubSpot → PostHog · normal or broken

Working vs. broken, side by side — HubSpot → PostHog

Normal, not a fault

  • The distinct_id present on the deal

  • Sent from a HubSpot workflow or webhook on deal stage change

  • Deduplicated correctly

    PostHog deduplicates on the event UUID where supplied. Without one, a retried batch duplicates, and on a self-hosted instance there is no vendor support desk to notice it for you.

  • Reconciles with the source

Actually broken

  • The distinct_id missing on most records

    The identifier has to be captured on the form and written to a contact property. HubSpot forms embedded in an iframe do not automatically see your page's cookies, so a hidden field has to be populated deliberately. Miss that and the contact is created clean, with nothing to join on ever again.

  • Sent from the browser

    B2B sales cycles routinely run past the attribution window of every ad platform. Value uploaded on day 95 is value nobody will accept, so the timing question has to be answered before anything is built.

  • Counted twice, or not at all

    The advantage of owning the pipeline is that nothing blocks it. The cost is that when the ingestion instance fills its disk on a Saturday, the events are gone and nobody is paged. Hosted tools fail differently and more visibly.

  • Nobody has reconciled it

HubSpot → PostHog · diagnose

Diagnostic order — HubSpot → PostHog

  1. 01

    Count deals carrying the distinct_id

  2. 02

    Follow one real conversion end to end

  3. 03

    Open a Closed Won deal and follow it back to its contact

    Does that contact carry the identifier property, populated? Then check the date gap between the contact's creation and the deal's close — that gap decides whether this integration is possible at all.

  4. 04

    Check ingestion health and disk before debugging any missing event

    On self-hosted instances the answer is infrastructure far more often than it is instrumentation.

  5. 05

    Read the match rate, not the success message

    PostHog shows events in the activity view within moments. On a self-hosted instance, check the ingestion lag as well — events that are queued are not events that are lost, and the two need different responses.

HubSpot → PostHog · prove

How it gets proven — HubSpot → PostHog

Source of truth

HubSpot's Deals report, filtered to Closed Won for the same window, by close date.

  • The distinct_id confirmed present on a live deal.
  • Purchase events reconciled per transaction against your billing system, with ingestion lag checked over the same window.
  • The click-to-close time distribution measured, so you know what share of deals close inside the destination's window.

HubSpot → PostHog · free audit

What we check in the free audit

  • Count deals carrying the distinct_id
  • Follow one real conversion end to end
  • Open a Closed Won deal and follow it back to its contact
  • Check ingestion health and disk before debugging any missing event
  • Read the match rate, not the success message

Checked against

HubSpot's Deals report, filtered to Closed Won for the same window, by close date.

Get my free conversion tracking audit

Free30 minutesNo obligation

HubSpot → PostHog · when not to buy

When you don't need this — HubSpot → PostHog

  • Measure identifier coverage yourself first — pull your last hundred deals and count how many carry the distinct_id.
  • If your median deal closes well past the destination's upload window, the honest answer is a different measurement strategy, not this integration. We will tell you that on the call rather than sell you a build that cannot work.
  • If you have no reason to keep the data on your own infrastructure and no team to run it, the hosted product removes the only real downside of this one.

HubSpot → PostHog · what we deliver

What gets built — HubSpot → PostHog

  • Identifier capture into HubSpot

    Create a custom contact property, populate a hidden form field from the persisted first-party cookie, and confirm the property lands on the contact rather than only on the form submission.

  • Event source: a HubSpot workflow or webhook on deal stage change

    Trigger when the deal reaches Closed Won and send the deal amount with the identifier stored on the associated contact. Sending on form submission instead means you optimize toward form fills, which is exactly the behavior that fills a pipeline with unqualified leads.

  • Dispatch to PostHog

    The PostHog capture API, posted server-side from your backend to your own instance or to PostHog Cloud.

  • Reversals where they exist

    A deal reopened or moved out of Closed Won can be retracted where the destination supports it, though most teams accept the small error here rather than wire it.

Written guarantee

95%+ tracking accuracy

Measured against HubSpot's Deals report, filtered to Closed Won for the same window, by close date.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

HubSpot → PostHog questions, answered

Yes, if the HubSpot contact stores the same distinct_id PostHog uses for that user. Send Closed Won as an event on that ID and on the company group, then build the funnel in PostHog.

Free · 30 min

Get HubSpot and PostHog joined properly

Free30 minutesNo obligation