Connecting Sanity to HubSpot
Sanity is a headless content platform, which means like every headless CMS it holds no commercial record and the tracking question lives elsewhere. HubSpot is where sales works, so a conversion that never reaches it is invisible to the people who decide what a lead was worth. The join between them succeeds or fails on one thing: whether the contact identity — email, or the hubspotutk cookie reaches the front-end conversion, not a Sanity record before the conversion happens, because HubSpot can only match a conversion it can tie back to a click it recognizes.
Free30 minutesNo obligation
Specific to this pair
Sanity front ends posting forms to HubSpot with the hutk
Submit the custom Sanity front-end form server-side to HubSpot's Forms API with the hubspotutk cookie as hutk plus page URL and name, so earlier page views link to the contact. Push page views to HubSpot on each client-side route change, and validate any Sanity-defined form fields against HubSpot properties. Report deal stage, not submissions.
Sanity has no forms, so the contact form on a Sanity-powered site is a custom component in the front end, usually React. Submit it server-side to HubSpot's Forms API with the hubspotutk cookie value in the submission context as hutk, plus the page URL and name. That is what links the visitor's earlier page views to the new contact. Without it the contact is created, and original source comes back as offline or direct.
The HubSpot tracking code also needs help on a single-page front end. On client-side route changes it does not see a new page load, so the app has to push the new path and a page view to HubSpot's queue on every navigation. Otherwise HubSpot records the first page of each visit and nothing after it, and attribution is built on landing pages alone.
A Sanity-specific trap: teams often let editors define form fields in Sanity so marketing can change forms without a developer. Adding a field in Sanity does not create the matching HubSpot property, and the Forms API rejects or drops unknown fields. Validate the Sanity form schema against HubSpot's form fields in the build. The conversion worth reporting is still the deal stage in HubSpot, not the submission.
Sanity → HubSpot · what breaks
Why this join usually fails — Sanity → HubSpot
- 01
The contact identity — email, or the hubspotutk cookie never reaches Sanity
The front-end application does the routing, the caching and the identifier capture. Single-page navigation is the usual failure and it belongs to the framework rather than to Sanity.
- 02
A headless stack diagnosed at the wrong layer
Route changes not tracked, identifiers lost between pages — these are front-end framework problems that get filed against the CMS because that is the name everyone knows.
- 03
Duplicate contacts
Two records for one person, each with half the history. Every downstream report is then wrong in a way that looks like a data problem rather than an integration problem.
- 04
Nothing reconciles afterwards
HubSpot shows the contact record and its timeline. A successful API response means HubSpot accepted the call, not that it resolved to the right contact — open the record and look.
Sanity → HubSpot · the fix
What working looks like — Sanity → HubSpot
The contact identity — email, or the hubspotutk cookie on every conversion
Conversions arriving in HubSpot
The revenue or conversion lands on the contact record and its associated deal, where sales can see it and where HubSpot's own attribution reporting can use it.
Reconciled against the source
Sanity → HubSpot · architecture
How Sanity and HubSpot actually connect
- 1
Sanity holds the truth
Sanity's real-time content APIs make it excellent at what it does and irrelevant to conversion measurement. Establishing that early saves the client money.
- 2
HubSpot needs a click to match
HubSpot needs to resolve the incoming data to an existing contact or create one. Without an email or a hubspotutk it creates duplicates, and duplicate contacts break every report built on top of them.
- 3
The identifier is the bridge
The contact identity — email, or the hubspotutk cookie, captured at the visit and carried into the front-end conversion, not a Sanity record.
- 4
The event source decides reliability
Send from wherever the money is recorded, not from the content layer.
- 5
Deduplication at the destination
HubSpot deduplicates contacts on email address. Events and property updates against the same contact are idempotent by design, but a second contact created for the same person is not detected, and merging them afterwards is manual work.
Sanity → HubSpot · normal or broken
Working vs. broken, side by side — Sanity → HubSpot
Normal, not a fault
The contact identity — email, or the hubspotutk cookie present on the conversion
Sent from your commerce or CRM system
Deduplicated correctly
HubSpot deduplicates contacts on email address. Events and property updates against the same contact are idempotent by design, but a second contact created for the same person is not detected, and merging them afterwards is manual work.
Reconciles with the source
Actually broken
The contact identity — email, or the hubspotutk cookie missing on most records
The front-end application does the routing, the caching and the identifier capture. Single-page navigation is the usual failure and it belongs to the framework rather than to Sanity.
Sent from the browser
Route changes not tracked, identifiers lost between pages — these are front-end framework problems that get filed against the CMS because that is the name everyone knows.
Counted twice, or not at all
Two records for one person, each with half the history. Every downstream report is then wrong in a way that looks like a data problem rather than an integration problem.
Nobody has reconciled it
Sanity → HubSpot · diagnose
Diagnostic order — Sanity → HubSpot
- 01
Count conversions carrying the contact identity — email, or the hubspotutk cookie
- 02
Follow one real conversion end to end
- 03
Identify the front-end framework, not the CMS
The routing behaviour that breaks tracking belongs to Next.js, Nuxt or whatever renders the site.
- 04
Search for the test contact by email after sending
One record or two? Then check whether the properties landed on the contact or only on the form submission — they are different things and only the first is usable.
- 05
Read the match rate, not the success message
HubSpot shows the contact record and its timeline. A successful API response means HubSpot accepted the call, not that it resolved to the right contact — open the record and look.
Sanity → HubSpot · prove
How it gets proven — Sanity → HubSpot
Source of truth
Your commerce, CRM or billing system — Sanity has no orders and no customers.
- The contact identity — email, or the hubspotutk cookie confirmed present on a live conversion.
- One contact record confirmed, not two, with the property visible on the contact rather than only on the submission.
- The conversion confirmed sourced from the commerce system, with front-end routing verified separately.
Sanity → HubSpot · free audit
What we check in the free audit
- Count conversions carrying the contact identity — email, or the hubspotutk cookie
- Follow one real conversion end to end
- Identify the front-end framework, not the CMS
- Search for the test contact by email after sending
- Read the match rate, not the success message
Checked against
Your commerce, CRM or billing system — Sanity has no orders and no customers.
Free30 minutesNo obligation
Sanity → HubSpot · when not to buy
When you don't need this — Sanity → HubSpot
- Measure identifier coverage yourself first — pull your last hundred conversions and count how many carry the contact identity — email, or the hubspotutk cookie.
- There is no Sanity-specific build. Fix the front end and the commerce integration; the CMS is not in the path.
- HubSpot's native form and tracking code already handle the straightforward cases well. This is worth building when the conversion happens somewhere HubSpot's code cannot see.
Sanity → HubSpot · what we deliver
What gets built — Sanity → HubSpot
Identifier capture into Sanity
Capture and persist the identifier server-side in the front-end application, then carry it into the system that records the sale.
Event source: your commerce or CRM system
Send from wherever the money is recorded, not from the content layer.
Dispatch to HubSpot
The HubSpot API — contact create-or-update with the properties, or a custom behavioral event where you need the timeline entry rather than a property.
Reversals where they exist
Handled by the commerce system.
Written guarantee
95%+ tracking accuracy
Measured against Your commerce, CRM or billing system — Sanity has no orders and no customers.. Miss it and we keep working at no cost.
From $400 · See packages
FAQ
Sanity → HubSpot questions, answered
Push the new path and a page view to HubSpot's tracking queue on every client-side route change. Without it, HubSpot only records the first page of each visit.
Embedded HubSpot forms handle the cookie and field mapping themselves. Custom forms give design control but must post the hutk and match HubSpot's field names exactly.
Almost always because the contact identity — email, or the hubspotutk cookie never reached the front-end conversion, not a Sanity record. The front-end application does the routing, the caching and the identifier capture. Single-page navigation is the usual failure and it belongs to the framework rather than to Sanity. Measure coverage before debugging the dispatch.
HubSpot resolves to a contact by email address, or by the hubspotutk cookie value which ties an anonymous visitor to their eventual contact record. Sending the hubspotutk with a form submission is what lets HubSpot stitch the pre-conversion page views to the contact, which is where the original source attribution comes from.
Your commerce or CRM system. Send from wherever the money is recorded, not from the content layer.
HubSpot shows the contact record and its timeline. A successful API response means HubSpot accepted the call, not that it resolved to the right contact — open the record and look.
More on Sanity → HubSpot
- Stripe → HubSpotConnecting Stripe to HubSpot
- Shopify → HubSpotConnecting Shopify to HubSpot
- WooCommerce → HubSpotConnecting WooCommerce to HubSpot
RELATED GUIDES
Where Sanity → HubSpot fits in the rest of your tracking
- AEM → HubSpotConnecting Adobe Experience Manager to HubSpot
- Craft → HubSpotConnecting Craft CMS to HubSpot
- Statamic → HubSpotConnecting Statamic to HubSpot
- Sanity → SalesforceConnecting Sanity to Salesforce
- Sanity → 6senseConnecting Sanity to 6sense
- Local servicesConversion tracking for local businesses, where most conversions bypass the website
- Contentful → HubSpotConnecting Contentful to HubSpot
- Drupal Commerce → HubSpotConnecting Drupal Commerce to HubSpot
Free · 30 min
Get Sanity and HubSpot joined properly
Free30 minutesNo obligation
