Skip to main content
Sanity → KlaviyoIntegration guide

Connecting Sanity to Klaviyo

Sanity is a headless content platform, which means like every headless CMS it holds no commercial record and the tracking question lives elsewhere. Klaviyo drives the flows, so an event it never receives is a flow that never triggers and revenue that never happens. The join between them succeeds or fails on one thing: whether the profile identity — email or phone reaches the front-end conversion, not a Sanity record before the conversion happens, because Klaviyo can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

Sanity storefronts and Klaviyo: orders come from commerce, not content

In a headless Shopify and Sanity stack, Placed Order comes from Klaviyo's Shopify integration, so do not add a second one. What breaks is onsite tracking: push Viewed Product from the product route on each client-side change, with IDs matching Klaviyo's catalog, and identify visitors at sign-up, or browse abandonment flows never fire.

Sanity is often paired with headless Shopify, with product content synced into Sanity. In that stack, Placed Order reaches Klaviyo from Klaviyo's Shopify integration, because Shopify holds the order. Sanity holds the product story, not the purchase. Check what the commerce integration already sends before writing any server event, since Klaviyo will not deduplicate a second Placed Order and the customer gets two confirmations.

What headless breaks is onsite behavior. On a standard Shopify theme, Klaviyo's onsite script and Viewed Product tracking come with the integration; on a custom front end reading from Sanity, nobody installs them unless a developer does. Push Viewed Product from the product route with the product ID that matches Klaviyo's catalog, and identify the visitor when they sign up so __kla_id resolves to a profile. Otherwise browse abandonment flows never fire and nobody notices for months.

Client-side route changes are the other gap. Klaviyo's script will not see a new page on navigation, so product-view events must be sent from the route change, not the initial load. Test by browsing three products in one session and checking that the profile's activity shows three Viewed Product events, each with the right product.

Sanity → Klaviyo · what breaks

Why this join usually fails — Sanity → Klaviyo

  1. 01

    The profile identity — email or phone 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.

  2. 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.

  3. 03

    Duplicate events trigger duplicate emails

    Unlike an ad platform, a duplicate here is visible to your customer. Two order confirmations for one order is a support ticket, not a reporting discrepancy.

  4. 04

    Nothing reconciles afterwards

    Klaviyo shows the event on the profile's activity feed within moments. Check the profile, not the API response — and specifically check whether the same metric is arriving twice from two sources.

Sanity → Klaviyo · the fix

What working looks like — Sanity → Klaviyo

  • The profile identity — email or phone on every conversion

  • Conversions arriving in Klaviyo

    The event lands on the profile, triggers the flows that depend on it, and becomes available for segmentation.

  • Reconciled against the source

Sanity → Klaviyo · architecture

How Sanity and Klaviyo actually connect

  1. 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. 2

    Klaviyo needs a click to match

    Klaviyo needs to resolve the event to a profile. Given an email it will create or update; given nothing it discards the event.

  3. 3

    The identifier is the bridge

    The profile identity — email or phone, captured at the visit and carried into the front-end conversion, not a Sanity record.

  4. 4

    The event source decides reliability

    Send from wherever the money is recorded, not from the content layer.

  5. 5

    Deduplication at the destination

    Klaviyo does not deduplicate events for you. Sending the same purchase from both the store integration and your own server produces two events, two flow triggers and potentially two emails to a customer who bought once.

Sanity → Klaviyo · normal or broken

Working vs. broken, side by side — Sanity → Klaviyo

Normal, not a fault

  • The profile identity — email or phone present on the conversion

  • Sent from your commerce or CRM system

  • Deduplicated correctly

    Klaviyo does not deduplicate events for you. Sending the same purchase from both the store integration and your own server produces two events, two flow triggers and potentially two emails to a customer who bought once.

  • Reconciles with the source

Actually broken

  • The profile identity — email or phone 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

    Unlike an ad platform, a duplicate here is visible to your customer. Two order confirmations for one order is a support ticket, not a reporting discrepancy.

  • Nobody has reconciled it

Sanity → Klaviyo · diagnose

Diagnostic order — Sanity → Klaviyo

  1. 01

    Count conversions carrying the profile identity — email or phone

  2. 02

    Follow one real conversion end to end

  3. 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.

  4. 04

    Open the profile's activity feed after a test event

    One event or two? Check whether the native store integration is already sending the same metric before you add a second source.

  5. 05

    Read the match rate, not the success message

    Klaviyo shows the event on the profile's activity feed within moments. Check the profile, not the API response — and specifically check whether the same metric is arriving twice from two sources.

Sanity → Klaviyo · prove

How it gets proven — Sanity → Klaviyo

Source of truth

Your commerce, CRM or billing system — Sanity has no orders and no customers.

  • The profile identity — email or phone confirmed present on a live conversion.
  • The profile activity feed confirmed to show one event per conversion, with no overlap against the native integration.
  • The conversion confirmed sourced from the commerce system, with front-end routing verified separately.

Sanity → Klaviyo · free audit

What we check in the free audit

  • Count conversions carrying the profile identity — email or phone
  • Follow one real conversion end to end
  • Identify the front-end framework, not the CMS
  • Open the profile's activity feed after a test event
  • Read the match rate, not the success message

Checked against

Your commerce, CRM or billing system — Sanity has no orders and no customers.

Get my free conversion tracking audit

Free30 minutesNo obligation

Sanity → Klaviyo · when not to buy

When you don't need this — Sanity → Klaviyo

  • Measure identifier coverage yourself first — pull your last hundred conversions and count how many carry the profile identity — email or phone.
  • There is no Sanity-specific build. Fix the front end and the commerce integration; the CMS is not in the path.
  • If Klaviyo's native store integration already sends the events your flows need, adding a second source creates duplicates rather than value.

Sanity → Klaviyo · what we deliver

What gets built — Sanity → Klaviyo

  • 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 Klaviyo

    The Klaviyo Events API with the profile identifiers and the event properties, sent server-side.

  • 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.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Sanity → Klaviyo questions, answered

Only if a developer installs the script and sends Viewed Product from each product route change. The commerce integration does not do it for a custom front end.

Free · 30 min

Get Sanity and Klaviyo joined properly

Free30 minutesNo obligation