Your campaign records leads. HubSpot records who qualified and who bought. Unless something connects the two, Meta never learns which leads turned into customers, and keeps optimizing for whoever fills in the form.
Key points
- When a deal changes stage in HubSpot, send an event to the Meta Conversions API: Qualified, Disqualified and Purchase with the deal amount.
- The identifiers that let Meta match the event (
fbc,fbp, or the Lead Ads ID) must be stored when the lead is created. They can't be recovered later. - In HubSpot, store them on the contact, then follow the deal's association to read them.
- Use
action_source: system_generated,custom_data.event_source: "crm"and a stableevent_idper deal and stage. - Check HubSpot's native Meta events first. If they cover your case, you may not need any code.
Step 1: store the identifier when the lead is born
This is the step that can't be fixed later. For leads from your site, save the _fbc and _fbp cookies, plus email and phone, into contact properties at submission. For leads from Meta's instant forms, save the leadgen_id.
Create contact properties with clear internal names, for example meta_fbc, meta_fbp and meta_lead_id. Your code always uses the internal name, never the label.
Two details catch most people: _fbc only exists when the visitor arrived with an fbclid in the URL, and it only works within the same domain.
Step 2: detect stage changes
With a HubSpot Service Key (legacy private apps can no longer be created), there are no webhooks, so a small bot polls the deals search endpoint every few minutes for deals modified since the last run, filtered by your pipeline.
For each deal that reached a tracked stage, it reads the deal's associated contact and takes the identifiers from there. Compare stages by their internal ID (closedwon, or a numeric ID in custom pipelines), never by label.
Step 3: build the Conversions API event
The payload has four details that decide whether Meta uses it:
action_sourceissystem_generated;custom_datacarrieslead_event_source(your CRM name) andevent_source: "crm";user_datahaslead_idfor instant-form leads, orfbcandfbpin plain text plus email and phone hashed with SHA-256;event_idis stable per deal and stage, like<deal id>_won, so a reprocessed run doesn't count twice.
For Purchase, add value and currency from the deal. HubSpot returns amount as a string and it may be empty when the stage moves before the rep fills it in, so wait a cycle instead of sending zero.
Step 4: keep outbound out of the signal
If the same pipeline gets paid leads and prospecting or referral deals, check for a paid-origin mark before sending anything. Otherwise every outbound sale becomes a Purchase credited to your campaigns.
Where to start
Start with Purchase: it's the only event with real value. Add Qualified next. If your funnel closes few deals a month, keep the campaign optimizing on a higher-volume event and use Purchase to judge quality.
The 4-Layer Tracking Kit has this bot ready in Python, built for HubSpot's 2026-03 API, plus the three layers before it (browser, web GTM and server-side GTM with deduplication) and a 12-step validation ladder.
FAQ
Isn't HubSpot's native Meta integration enough?
Sometimes. HubSpot can send ad conversion events to Meta based on lifecycle stage changes and HubSpot form submissions, on Marketing Hub Starter and above. It doesn't cover deal stages in any pipeline, forms outside HubSpot or a pixel that lives in GTM with server-side tracking. Don't run both for the same conversions, or Meta receives each one twice.
What action_source should a CRM event use?
system_generated. The event didn't happen in a browser. Also include custom_data.lead_event_source with your CRM name and custom_data.event_source set to crm, otherwise Meta may accept the event and not use it for lead optimization.
Should fbc and fbp be hashed?
No. Click and browser identifiers go in plain text. Only personal data like email and phone are hashed with SHA-256.