Connecting Sanity to Customer.io
Sanity is a headless content platform, which means like every headless CMS it holds no commercial record and the tracking question lives elsewhere. Customer.io triggers messages from behaviour, which means an event you send is not recorded — it is acted on, usually within seconds, by sending something to a real person. The join between them succeeds or fails on one thing: whether the person identifier you assign reaches the front-end conversion, not a Sanity record before the conversion happens, because Customer.io can only match a conversion it can tie back to a click it recognizes.
Free30 minutesNo obligation
Specific to this pair
Sanity webhooks into Customer.io: stop edits from resending emails
A Sanity publish webhook usually triggers a Customer.io API-triggered broadcast, so restrict it to the first publish of the relevant document type or check an announced flag. Exclude drafts, give each dataset its own webhook and Customer.io credentials, and project title, URL and image in GROQ. Purchases and sign-ups come from your app or commerce system.
The usual build is a Sanity publish webhook that triggers a Customer.io API-triggered broadcast: new article, new collection, new episode. Customer.io acts on that call within seconds and emails real people, so the webhook's filter is effectively your send rule. A webhook firing on every update resends the announcement each time an editor fixes a typo after publishing. Restrict it to the first publish of the relevant document type, or check a flag on the document that records it was already announced.
Environments cause the other accidents. Sanity keeps drafts as separate documents with a drafts prefix on the ID, and a webhook configured to include drafts can announce something nobody published. A webhook on a staging or development dataset pointed at the production Customer.io workspace emails customers about test content. Give each dataset its own webhook and its own Customer.io credentials.
Customer.io needs the attributes your broadcast template references, so project them in the webhook's GROQ: title, URL, hero image. A missing slug produces an email with a broken link rather than an error. Purchases and sign-ups come from your app or commerce system under the person identifier; Sanity carries no person and should never send behavioural events.
Sanity → Customer.io · what breaks
Why this join usually fails — Sanity → Customer.io
- 01
The person identifier you assign 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
A test event sending a real email
Because campaigns evaluate on arrival, there is no safe place to test in production. A malformed purchase event fired during development against a live workspace will send a real order confirmation to a real person, and that cannot be recalled.
- 04
Nothing reconciles afterwards
Customer.io shows the event and the resulting campaign activity on the person's timeline. Check what the event triggered, not just that it arrived.
Sanity → Customer.io · the fix
What working looks like — Sanity → Customer.io
The person identifier you assign on every conversion
Conversions arriving in Customer.io
The event lands on the person, evaluates against every campaign trigger and segment condition, and may send immediately.
Reconciled against the source
Sanity → Customer.io · architecture
How Sanity and Customer.io 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
Customer.io needs a click to match
Customer.io needs the person identifier, the event name and any attributes the campaign conditions reference. An event whose attributes are missing will still trigger a campaign, which may then send a message with an empty placeholder in it.
- 3
The identifier is the bridge
The person identifier you assign, 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
Customer.io does not deduplicate events. A purchase sent twice can enter a workflow twice and send two emails, and unlike a reporting duplicate the customer sees this one.
Sanity → Customer.io · normal or broken
Working vs. broken, side by side — Sanity → Customer.io
Normal, not a fault
The person identifier you assign present on the conversion
Sent from your commerce or CRM system
Deduplicated correctly
Customer.io does not deduplicate events. A purchase sent twice can enter a workflow twice and send two emails, and unlike a reporting duplicate the customer sees this one.
Reconciles with the source
Actually broken
The person identifier you assign 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
Because campaigns evaluate on arrival, there is no safe place to test in production. A malformed purchase event fired during development against a live workspace will send a real order confirmation to a real person, and that cannot be recalled.
Nobody has reconciled it
Sanity → Customer.io · diagnose
Diagnostic order — Sanity → Customer.io
- 01
Count conversions carrying the person identifier you assign
- 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
Confirm which workspace you are writing to before sending anything
Environment separation is the whole safety mechanism in behaviour-triggered tools, and it is the thing most often skipped.
- 05
Read the match rate, not the success message
Customer.io shows the event and the resulting campaign activity on the person's timeline. Check what the event triggered, not just that it arrived.
Sanity → Customer.io · prove
How it gets proven — Sanity → Customer.io
Source of truth
Your commerce, CRM or billing system — Sanity has no orders and no customers.
- The person identifier you assign confirmed present on a live conversion.
- Events confirmed on person profiles with the triggered campaign activity verified, in a test workspace before production.
- The conversion confirmed sourced from the commerce system, with front-end routing verified separately.
Sanity → Customer.io · free audit
What we check in the free audit
- Count conversions carrying the person identifier you assign
- Follow one real conversion end to end
- Identify the front-end framework, not the CMS
- Confirm which workspace you are writing to before sending anything
- 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 → Customer.io · when not to buy
When you don't need this — Sanity → Customer.io
- Measure identifier coverage yourself first — pull your last hundred conversions and count how many carry the person identifier you assign.
- There is no Sanity-specific build. Fix the front end and the commerce integration; the CMS is not in the path.
- If your messaging is scheduled rather than behavioural, a simpler email platform does the job and removes the whole class of accidental-send risk.
Sanity → Customer.io · what we deliver
What gets built — Sanity → Customer.io
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 Customer.io
The Customer.io Track API, posted server-side from your order or product system with the person identifier and event attributes.
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 → Customer.io questions, answered
Yes, by calling Customer.io's API-triggered broadcast, usually through a small function in between. Limit it to the first publish, or every edit resends.
The webhook included draft documents or fired from a non-production dataset. Exclude drafts and keep separate credentials per dataset.
Almost always because the person identifier you assign 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.
Customer.io identifies people by an ID you control, with email as a common choice. Anonymous events can be sent and later merged, but a mismatch creates a second profile — and a second profile means a second copy of every campaign that person is enrolled in.
Your commerce or CRM system. Send from wherever the money is recorded, not from the content layer.
Customer.io shows the event and the resulting campaign activity on the person's timeline. Check what the event triggered, not just that it arrived.
More on Sanity → Customer.io
- Stripe → Customer.ioConnecting Stripe to Customer.io
- PayPal → Customer.ioConnecting PayPal to Customer.io
- Shopify → Customer.ioConnecting Shopify to Customer.io
RELATED GUIDES
Where Sanity → Customer.io fits in the rest of your tracking
- Webflow → Customer.ioConnecting Webflow to Customer.io
- Statamic → Customer.ioConnecting Statamic to Customer.io
- Craft → Customer.ioConnecting Craft CMS to Customer.io
- Sanity → BrazeConnecting Sanity to Braze
- Sanity → AttentiveConnecting Sanity to Attentive
- Local servicesConversion tracking for local businesses, where most conversions bypass the website
- Umbraco → Customer.ioConnecting Umbraco to Customer.io
- AEM → Customer.ioConnecting Adobe Experience Manager to Customer.io
Free · 30 min
Get Sanity and Customer.io joined properly
Free30 minutesNo obligation
