Connecting Drupal Commerce to AppsFlyer
Drupal Commerce is self-hosted commerce inside a CMS built for complex content, which means the store is one part of a much larger site you fully control. 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 Drupal 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
Drupal Commerce to AppsFlyer: app orders by device ID only
Only for app orders placed against Drupal Commerce: the app passes its appsflyer_id in the order API call, Drupal stores it as a required order field, and the order placement hook posts the purchase to AppsFlyer's server-to-server events API with revenue and currency. Use the server as the only purchase sender.
AppsFlyer only matters here if a mobile app places orders against your Drupal Commerce backend. Then the join is the appsflyer_id: the app passes it in the order API call, Drupal stores it as an order field, and the order placement hook posts the purchase to AppsFlyer's server-to-server events API with that device ID, the revenue and currency. An order without the device ID cannot be tied to an install, so make the field required for app checkouts and count how many arrive empty.
Pick one sender for purchases. If the app SDK already logs af_purchase when the confirmation screen shows, and Drupal also posts it from the server, AppsFlyer counts two purchases and forwards both to every ad network connected to it. The server copy is the better one, because it reflects the order Drupal actually placed after payment, including payments that confirmed through an offsite gateway after the user left the app.
Web orders from the same Drupal store should go to your web ad platforms directly, not through AppsFlyer, unless you are deliberately using its web attribution product. Refunds and cancellations recorded on the Drupal order should be sent as a separate negative or cancellation event your AppsFlyer setup recognizes; confirm the event name and how your partners treat it before sending.
Drupal Commerce → AppsFlyer · what breaks
Why this join usually fails — Drupal Commerce → AppsFlyer
- 01
The AppsFlyer device identifier, appsflyer_id never reaches Drupal Commerce
Drupal's internal page cache and any reverse proxy in front of it serve stored renders, so anything relying on dynamically rendered values fails intermittently. Multilingual and multi-site installs add further paths where the capture code may simply not run.
- 02
Configurable workflow states nobody agreed on
Drupal Commerce lets each install define its own order states. Two people reporting on the same store routinely count different states and never reconcile.
- 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.
Drupal Commerce → AppsFlyer · the fix
What working looks like — Drupal Commerce → 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
Drupal Commerce → AppsFlyer · architecture
How Drupal Commerce and AppsFlyer actually connect
- 1
Drupal Commerce holds the truth
You own the database, so the truth is exactly as good as the query. Pin down which order states count as revenue before comparing anything — Drupal's workflow states are configurable per install, so no two sites agree by default.
- 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 Drupal Commerce order.
- 4
The event source decides reliability
Fire server-side from the hook rather than the checkout completion template, which is cacheable and may not execute anything.
- 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.
Drupal Commerce → AppsFlyer · normal or broken
Working vs. broken, side by side — Drupal Commerce → AppsFlyer
Normal, not a fault
The AppsFlyer device identifier, appsflyer_id present on the order
Sent from the Drupal Commerce order placement hook
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
Drupal's internal page cache and any reverse proxy in front of it serve stored renders, so anything relying on dynamically rendered values fails intermittently. Multilingual and multi-site installs add further paths where the capture code may simply not run.
Sent from the browser
Drupal Commerce lets each install define its own order states. Two people reporting on the same store routinely count different states and never reconcile.
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
Drupal Commerce → AppsFlyer · diagnose
Diagnostic order — Drupal Commerce → AppsFlyer
- 01
Count orders carrying the AppsFlyer device identifier, appsflyer_id
- 02
Follow one real conversion end to end
- 03
List the order states in use and agree which count as revenue
Do this before any technical work — it resolves more Drupal Commerce disputes than any code change.
- 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.
Drupal Commerce → AppsFlyer · prove
How it gets proven — Drupal Commerce → AppsFlyer
Source of truth
Drupal's commerce_order records in your own database, filtered to completed states.
- 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 field data confirmed populated on an order placed through a fully warmed cache as an anonymous visitor.
Drupal Commerce → 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
- List the order states in use and agree which count as revenue
- Check what share of your revenue happens in the app at all
- Read the match rate, not the success message
Checked against
Drupal's commerce_order records in your own database, filtered to completed states.
Free30 minutesNo obligation
Drupal Commerce → AppsFlyer · when not to buy
When you don't need this — Drupal Commerce → AppsFlyer
- Measure identifier coverage yourself first — pull your last hundred orders and count how many carry the AppsFlyer device identifier, appsflyer_id.
- If your Drupal site is content-only with commerce elsewhere, work at the commerce system instead — this is the wrong layer.
- 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.
Drupal Commerce → AppsFlyer · what we deliver
What gets built — Drupal Commerce → AppsFlyer
Identifier capture into Drupal Commerce
Capture the identifier and persist it as order field data through a hook on order placement, server-side, so it never depends on what the cache served.
Event source: the Drupal Commerce order placement hook
Fire server-side from the hook rather than the checkout completion template, which is cacheable and may not execute anything.
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
Order state transitions to refunded or cancelled are recorded and can drive reversals.
Written guarantee
95%+ tracking accuracy
Measured against Drupal's commerce_order records in your own database, filtered to completed states.. Miss it and we keep working at no cost.
From $400 · See packages
FAQ
Drupal Commerce → AppsFlyer questions, answered
Have the app pass its appsflyer_id with the order, store it on the Drupal order, and post the purchase server-to-server from the order placement hook with revenue and currency.
Both the app SDK and the server are sending the purchase. Keep one sender, preferably the server, which reports the order Drupal actually placed.
Almost always because the AppsFlyer device identifier, appsflyer_id never reached the Drupal Commerce order. Drupal's internal page cache and any reverse proxy in front of it serve stored renders, so anything relying on dynamically rendered values fails intermittently. Multilingual and multi-site installs add further paths where the capture code may simply not run. 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 Drupal Commerce order placement hook. Fire server-side from the hook rather than the checkout completion template, which is cacheable and may not execute anything.
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 Drupal Commerce → AppsFlyer
- Drupal Commerce → Google AdsConnecting Drupal Commerce to Google Ads
- Drupal Commerce → MetaConnecting Drupal Commerce to Meta Conversions API
- Drupal Commerce → GA4Connecting Drupal Commerce to GA4
RELATED GUIDES
Where Drupal Commerce → AppsFlyer fits in the rest of your tracking
- Sitecore → AppsFlyerConnecting Sitecore to AppsFlyer
- Statamic → AppsFlyerConnecting Statamic to AppsFlyer
- Contentful → AppsFlyerConnecting Contentful to AppsFlyer
- Local servicesConversion tracking for local businesses, where most conversions bypass the website
- Ghost → AppsFlyerConnecting Ghost memberships to AppsFlyer
- Concrete CMS → AppsFlyerConnecting Concrete CMS to AppsFlyer
- Webflow → AppsFlyerConnecting Webflow to AppsFlyer
- Craft → AppsFlyerConnecting Craft CMS to AppsFlyer
Free · 30 min
Get Drupal Commerce and AppsFlyer joined properly
Free30 minutesNo obligation
