Connecting Craft CMS to AppsFlyer
Craft is a developer-oriented CMS, usually built bespoke by an agency, which means the implementation is whatever that agency decided and nothing is standard. 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 Craft Commerce order 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
Craft Commerce to AppsFlyer: only orders placed in the app
Only app-placed Craft Commerce orders belong in AppsFlyer. In headless setups, have the app send its appsflyer_id with the cart, store it in an order custom field alongside a channel field, and post the purchase server-to-server from the order-complete listener with order total, currency and order reference, without an SDK duplicate.
AppsFlyer attributes app installs and in-app events, and most Craft Commerce revenue happens on the website, where there is no install and no device ID. Sending those web orders to AppsFlyer either discards them or files them as organic, so the first question is how much of your Commerce revenue actually originates in an app at all.
When Craft runs headless behind an app, the app places orders against Craft Commerce through GraphQL or a custom controller, and the server is where the order completes. That is the case for server-to-server events: have the app send its appsflyer_id with the cart, store it in an order custom field, and post the purchase from the order-complete listener with that ID, the order total and currency. Use the order reference as the event identifier and make sure the app SDK does not also log the same purchase.
Split orders by channel in Craft before sending anything, with a custom field recording whether the cart came from the app or the web. Only app orders go to AppsFlyer; web orders go to the web ad platforms. Refunds recorded against an app order can be sent as their own event so revenue forwarded to the ad networks drops too, if your AppsFlyer setup is configured for it.
Craft → AppsFlyer · what breaks
Why this join usually fails — Craft → AppsFlyer
- 01
The AppsFlyer device identifier, appsflyer_id never reaches Craft
Craft's template caching and static caching plugins both serve stored output, and because every build is custom, where the capture code lives differs per site. There is no standard place to look.
- 02
Every install is bespoke
There is no standard Craft setup, so an approach that worked on another Craft site may have nothing to attach to on this one. Read the build before quoting.
- 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.
Craft → AppsFlyer · the fix
What working looks like — Craft → AppsFlyer
The AppsFlyer device identifier, appsflyer_id on every order
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
Craft CMS's own records are the reference, not either dashboard.
Craft → AppsFlyer · architecture
How Craft and AppsFlyer actually connect
- 1
Craft CMS holds the truth
Craft installs are bespoke by nature. Establish how this particular build models a completed order before assuming anything transfers from another Craft site.
- 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 Craft Commerce order.
- 4
The event source decides reliability
Fire from the event listener in PHP rather than a Twig template, which may be cached.
- 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.
Craft → AppsFlyer · normal or broken
Working vs. broken, side by side — Craft → AppsFlyer
Normal, not a fault
The AppsFlyer device identifier, appsflyer_id present on the order
Visible on the record itself in Craft CMS, not merely captured somewhere on the site.
Sent from the Craft Commerce order-complete event
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
AppsFlyer's count and Craft CMS's records agree within a few percent over a closed window.
Actually broken
The AppsFlyer device identifier, appsflyer_id missing on most records
Craft's template caching and static caching plugins both serve stored output, and because every build is custom, where the capture code lives differs per site. There is no standard place to look.
Sent from the browser
There is no standard Craft setup, so an approach that worked on another Craft site may have nothing to attach to on this one. Read the build before quoting.
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
The dashboard shows a number and no one has compared it to Craft CMS.
Craft → AppsFlyer · diagnose
Diagnostic order — Craft → AppsFlyer
- 01
Count orders carrying the AppsFlyer device identifier, appsflyer_id
- 02
Follow one real conversion end to end
- 03
Read how this specific build handles order completion
Assumptions carried from another Craft project are the main source of wasted time here.
- 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.
Craft → AppsFlyer · prove
How it gets proven — Craft → AppsFlyer
Against Craft CMS's own records, not against either platform's dashboard.
Source of truth
Craft Commerce's order records in your own database, filtered to completed.
- The AppsFlyer device identifier, appsflyer_id confirmed present on a live order.
- In-app revenue events reconciled per transaction against your billing system, with the organic share stated rather than assumed away.
- Order custom field confirmed populated on an order placed as an anonymous visitor through cache.
Craft → AppsFlyer · free audit
What we check in the free audit
- Count orders carrying the AppsFlyer device identifier, appsflyer_id
- Follow one real conversion end to end
- Read how this specific build handles order completion
- Check what share of your revenue happens in the app at all
- Read the match rate, not the success message
Checked against
Craft Commerce's order records in your own database, filtered to completed.
Free30 minutesNo obligation
Craft → AppsFlyer · when not to buy
When you don't need this — Craft → AppsFlyer
- If AppsFlyer already reports conversions that reconcile against Craft CMS's records within a few percent, this join is working and there is nothing to buy.
- Measure identifier coverage yourself first — pull your last hundred orders and count how many carry the AppsFlyer device identifier, appsflyer_id.
- If the original agency is still engaged, the fastest path is usually specifying the field and having them add the hook.
- 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.
Craft → AppsFlyer · what we deliver
What gets built — Craft → AppsFlyer
Identifier capture into Craft
Capture the identifier and store it as a custom field on the order through a Craft event listener, server-side.
Event source: the Craft Commerce order-complete event
Fire from the event listener in PHP rather than a Twig template, which may be cached.
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
Refunds and cancelled orders are recorded against the order.
Written guarantee
95%+ tracking accuracy
Measured against Craft Commerce's order records in your own database, filtered to completed.. Miss it and we keep working at no cost.
From $400 · See packages
FAQ
Craft → AppsFlyer questions, answered
Not usefully. Web orders have no install or device ID behind them; send them to your web ad platforms and keep AppsFlyer for orders placed in the app.
Pass the appsflyer_id from the app with the cart, store it on the order, and post the purchase server-side from the order-complete event. Do not also log the purchase from the SDK.
Almost always because the AppsFlyer device identifier, appsflyer_id never reached the Craft Commerce order. Craft's template caching and static caching plugins both serve stored output, and because every build is custom, where the capture code lives differs per site. There is no standard place to look. 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.
The Craft Commerce order-complete event. Fire from the event listener in PHP rather than a Twig template, which may be cached.
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 Craft → AppsFlyer
- Craft → Google AdsConnecting Craft CMS to Google Ads
- Craft → MetaConnecting Craft CMS to Meta Conversions API
- Craft → GA4Connecting Craft CMS to GA4
RELATED GUIDES
Where Craft → AppsFlyer fits in the rest of your tracking
- Umbraco → AppsFlyerConnecting Umbraco to AppsFlyer
- Concrete CMS → AppsFlyerConnecting Concrete CMS to AppsFlyer
- Duda → AppsFlyerConnecting Duda to AppsFlyer
- Local servicesConversion tracking for local businesses, where most conversions bypass the website
- Statamic → AppsFlyerConnecting Statamic to AppsFlyer
- Contentful → AppsFlyerConnecting Contentful to AppsFlyer
- Sanity → AppsFlyerConnecting Sanity to AppsFlyer
- AEM → AppsFlyerConnecting Adobe Experience Manager to AppsFlyer
Free · 30 min
Get Craft and AppsFlyer joined properly
Free30 minutesNo obligation
