Skip to main content
Craft → AppsFlyerIntegration guide

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

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

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

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

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

    The identifier is the bridge

    The AppsFlyer device identifier, appsflyer_id, captured at the visit and carried into the Craft Commerce order.

  4. 4

    The event source decides reliability

    Fire from the event listener in PHP rather than a Twig template, which may be cached.

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

  1. 01

    Count orders carrying the AppsFlyer device identifier, appsflyer_id

  2. 02

    Follow one real conversion end to end

  3. 03

    Read how this specific build handles order completion

    Assumptions carried from another Craft project are the main source of wasted time here.

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

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

Get my free conversion tracking audit

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.

Get my free conversion tracking audit

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.

Free · 30 min

Get Craft and AppsFlyer joined properly

Free30 minutesNo obligation