Connecting Sanity to AppsFlyer
Sanity is a headless content platform, which means like every headless CMS it holds no commercial record and the tracking question lives elsewhere. AppsFlyer exists because mobile app attribution is a different problem from web attribution, and on iOS a large share of it is now aggregated and delayed by design rather than by accident. The join between them succeeds or fails on one thing: whether the AppsFlyer device identifier, appsflyer_id reaches the front-end conversion, not a Sanity record before the conversion happens, because AppsFlyer can only match a conversion it can tie back to a click it recognizes.
Free30 minutesNo obligation
Specific to this pair
Sanity sites and AppsFlyer: web-to-app links, not web purchases
Use AppsFlyer for the web-to-app hop on a Sanity site: render OneLinks from Sanity fields holding the template and deep link value, with campaign values from the visitor's landing parameters. Key deep links on the Sanity document _id so slug renames do not break shared links. Never send web sign-ups or purchases to AppsFlyer as in-app events.
AppsFlyer's place on a Sanity-built site is the web-to-app hop: banners and buttons on content pages that move readers into your app. Those links should be OneLinks whose campaign values come from the visitor's own landing parameters, which is what AppsFlyer's web tooling for banners and link generation is for; confirm what your plan includes. Store the OneLink template and deep link value as Sanity fields that a component renders, rather than URLs pasted into rich text, so an editor cannot publish a link without the deep link value.
Point deep link values at something the app can resolve that will not change. If the app routes by slug and an editor renames a slug in Sanity, every OneLink already shared opens to an empty screen, and AppsFlyer still reports the install as attributed, so nothing in the dashboard looks wrong. Key deep links on the Sanity document _id and have the app query by ID.
What not to do: send web sign-ups or purchases from the Sanity site to AppsFlyer as in-app events. They carry no appsflyer_id, cannot be tied to an install, and inflate app revenue in every partner AppsFlyer forwards to. Web conversions belong with your web ad platforms; AppsFlyer gets installs and in-app events from the SDK or your server.
Sanity → AppsFlyer · what breaks
Why this join usually fails — Sanity → AppsFlyer
- 01
The AppsFlyer device identifier, appsflyer_id 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
Web conversions sent to a mobile attribution platform
This is the common error and it produces confident nonsense. A purchase made on your website has no device identifier and no install behind it. AppsFlyer will either discard it or attribute it to nothing, and the revenue disappears somewhere between the two systems without anyone noticing it went.
- 04
Nothing reconciles afterwards
AppsFlyer shows the event on the raw data export with its attributed media source. Check the raw export, not the aggregate dashboard, and confirm the event carries a device identifier rather than landing as organic.
Sanity → AppsFlyer · the fix
What working looks like — Sanity → AppsFlyer
The AppsFlyer device identifier, appsflyer_id on every conversion
Conversions arriving in AppsFlyer
The event is attributed to the install source, forwarded to whichever networks are configured, and appears in the cohort reporting.
Reconciled against the source
Sanity → AppsFlyer · architecture
How Sanity and AppsFlyer 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
AppsFlyer needs a click to match
AppsFlyer needs the device identifier and an event name it recognizes, plus the revenue value for in-app purchases. A server event about a user with no linked device cannot be attributed to an install.
- 3
The identifier is the bridge
The AppsFlyer device identifier, appsflyer_id, 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
AppsFlyer deduplicates in-app events by its own event identifier. Sending the same purchase from both the SDK and your server produces two events and double-counts revenue in every dashboard downstream, including the ad networks AppsFlyer forwards to.
Sanity → AppsFlyer · normal or broken
Working vs. broken, side by side — Sanity → AppsFlyer
Normal, not a fault
The AppsFlyer device identifier, appsflyer_id present on the conversion
Sent from your commerce or CRM system
Deduplicated correctly
AppsFlyer deduplicates in-app events by its own event identifier. Sending the same purchase from both the SDK and your server produces two events and double-counts revenue in every dashboard downstream, including the ad networks AppsFlyer forwards to.
Reconciles with the source
Actually broken
The AppsFlyer device identifier, appsflyer_id 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
This is the common error and it produces confident nonsense. A purchase made on your website has no device identifier and no install behind it. AppsFlyer will either discard it or attribute it to nothing, and the revenue disappears somewhere between the two systems without anyone noticing it went.
Nobody has reconciled it
Sanity → AppsFlyer · diagnose
Diagnostic order — Sanity → AppsFlyer
- 01
Count conversions carrying the AppsFlyer device identifier, appsflyer_id
- 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
Check what share of your revenue happens in the app at all
If most purchases are on the web, AppsFlyer is not your conversion destination and the work belongs somewhere else entirely.
- 05
Read the match rate, not the success message
AppsFlyer shows the event on the raw data export with its attributed media source. Check the raw export, not the aggregate dashboard, and confirm the event carries a device identifier rather than landing as organic.
Sanity → AppsFlyer · prove
How it gets proven — Sanity → AppsFlyer
Source of truth
Your commerce, CRM or billing system — Sanity has no orders and no customers.
- The AppsFlyer device identifier, appsflyer_id confirmed present on a live conversion.
- In-app revenue events reconciled per transaction against your billing system, with the organic share stated rather than assumed away.
- The conversion confirmed sourced from the commerce system, with front-end routing verified separately.
Sanity → AppsFlyer · free audit
What we check in the free audit
- Count conversions carrying the AppsFlyer device identifier, appsflyer_id
- Follow one real conversion end to end
- Identify the front-end framework, not the CMS
- Check what share of your revenue happens in the app at all
- 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 → AppsFlyer · when not to buy
When you don't need this — Sanity → AppsFlyer
- Measure identifier coverage yourself first — pull your last hundred conversions and count how many carry the AppsFlyer device identifier, appsflyer_id.
- There is no Sanity-specific build. Fix the front end and the commerce integration; the CMS is not in the path.
- If you have no mobile app, this is not a destination for you. If you have one but sell mostly on the web, send web conversions to your ad platforms directly and use AppsFlyer only for install and in-app events.
Sanity → AppsFlyer · what we deliver
What gets built — Sanity → AppsFlyer
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 AppsFlyer
The AppsFlyer server-to-server events API, posted from your billing system with the device identifier and revenue.
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 → AppsFlyer questions, answered
Load AppsFlyer's web script in the front-end app, not in Sanity, and keep the OneLink template and deep link values as Sanity fields the banner component renders.
Usually the deep link value is a slug that was later changed, or the link was pasted without a deep link value. Key deep links on document IDs.
Almost always because the AppsFlyer device identifier, appsflyer_id 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.
AppsFlyer assigns its own device ID and matches installs to clicks through referrer data on Android and Apple's frameworks on iOS. There is no durable cross-device identifier. On iOS without ATT consent, attribution falls back to SKAdNetwork, which returns aggregated conversion values on a delay with no user-level detail at all — so a share of your installs will be attributable only in aggregate, permanently.
Your commerce or CRM system. Send from wherever the money is recorded, not from the content layer.
AppsFlyer shows the event on the raw data export with its attributed media source. Check the raw export, not the aggregate dashboard, and confirm the event carries a device identifier rather than landing as organic.
More on Sanity → AppsFlyer
- Sanity → Google AdsConnecting Sanity to Google Ads
- Sanity → MetaConnecting Sanity to Meta Conversions API
- Sanity → GA4Connecting Sanity to GA4
RELATED GUIDES
Where Sanity → AppsFlyer fits in the rest of your tracking
- Contentful → AppsFlyerConnecting Contentful to AppsFlyer
- Ghost → AppsFlyerConnecting Ghost memberships to AppsFlyer
- Umbraco → AppsFlyerConnecting Umbraco to AppsFlyer
- Local servicesConversion tracking for local businesses, where most conversions bypass the website
- Webflow → AppsFlyerConnecting Webflow to AppsFlyer
- Sitecore → AppsFlyerConnecting Sitecore to AppsFlyer
- Drupal Commerce → AppsFlyerConnecting Drupal Commerce to AppsFlyer
- Duda → AppsFlyerConnecting Duda to AppsFlyer
Free · 30 min
Get Sanity and AppsFlyer joined properly
Free30 minutesNo obligation
