Skip to main content
Medusa → AppsFlyerIntegration guide

Connecting Medusa to AppsFlyer

Medusa is a Node commerce engine you extend in your own codebase, which makes the conversion event a piece of application code — and therefore something that can be tested rather than hoped for. 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 Medusa 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

Medusa app orders to AppsFlyer without double counting

Have the app write its appsflyer_id into Medusa cart metadata, then post a server-to-server purchase at payment capture with the captured total, the order's own currency and the display ID. Remove any SDK confirmation-screen purchase event so orders don't count twice. Leave web orders without an appsflyer_id out, and key refunds to the order.

When a Medusa backend serves a native shopping app, AppsFlyer can attribute revenue to app campaigns, provided the order reaches it with the device identifier. Have the app write its appsflyer_id into cart metadata when the cart is created; at payment capture your subscriber posts a purchase event server-to-server with that ID, the captured total, the currency, and the order's display ID.

The common mistake is sending purchases twice. App teams often fire an in-app purchase event from the SDK when the confirmation screen appears, and if the server event is added on top, every order counts double. Pick one: the server event from the subscriber is more reliable, because it fires on captured payment rather than on a screen that may never render, but then remove the SDK purchase event.

Medusa's multi-region setup matters here too. Send each order in its own currency rather than a converted amount, and let AppsFlyer convert to your app's reporting currency. Orders placed on the web storefront by an app-installed user will not carry an appsflyer_id and should not be forced into AppsFlyer. Report refunds as their own event if you need net revenue, keyed to the same order ID.

Medusa → AppsFlyer · what breaks

Why this join usually fails — Medusa → AppsFlyer

  1. 01

    The AppsFlyer device identifier, appsflyer_id never reaches Medusa

    The storefront is separate from the backend, and the identifier must be attached to the cart before the order is created.

  2. 02

    Firing on order placed rather than payment captured

    They are different events and the gap between them contains every failed and pending payment. Order-placed is the easier hook and the wrong one.

  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.

Medusa → AppsFlyer · the fix

What working looks like — Medusa → 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

Medusa → AppsFlyer · architecture

How Medusa and AppsFlyer actually connect

  1. 1

    Medusa holds the truth

    Because you own the event handlers, the conversion can fire from the payment-captured event specifically rather than from whatever the frontend happened to render.

  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 Medusa order.

  4. 4

    The event source decides reliability

    Send orders at payment capture, at the paid total.

  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.

Medusa → AppsFlyer · normal or broken

Working vs. broken, side by side — Medusa → AppsFlyer

Normal, not a fault

  • The AppsFlyer device identifier, appsflyer_id present on the order

  • Sent from a Medusa subscriber on order payment capture

  • 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 storefront is separate from the backend, and the identifier must be attached to the cart before the order is created.

  • Sent from the browser

    They are different events and the gap between them contains every failed and pending payment. Order-placed is the easier hook and the wrong one.

  • 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

Medusa → AppsFlyer · diagnose

Diagnostic order — Medusa → AppsFlyer

  1. 01

    Count orders carrying the AppsFlyer device identifier, appsflyer_id

  2. 02

    Follow one real conversion end to end

  3. 03

    Check which event your subscriber listens to

    One line of code, and it decides whether you are counting orders or counting money.

  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.

Medusa → AppsFlyer · prove

How it gets proven — Medusa → AppsFlyer

Source of truth

Medusa orders by payment status, emitted from your own subscriber code.

  • 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.
  • Payment-captured orders reconciled against imported conversions.

Medusa → 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
  • Check which event your subscriber listens to
  • Check what share of your revenue happens in the app at all
  • Read the match rate, not the success message

Checked against

Medusa orders by payment status, emitted from your own subscriber code.

Get my free conversion tracking audit

Free30 minutesNo obligation

Medusa → AppsFlyer · when not to buy

When you don't need this — Medusa → AppsFlyer

  • Measure identifier coverage yourself first — pull your last hundred orders and count how many carry the AppsFlyer device identifier, appsflyer_id.
  • If every payment method you accept is instant, the two events nearly coincide and the distinction costs more than it returns.
  • 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.

Medusa → AppsFlyer · what we deliver

What gets built — Medusa → AppsFlyer

  • Identifier capture into Medusa

    Write the identifier into cart metadata at first touch so it is carried onto the order automatically at completion.

  • Event source: a Medusa subscriber on order payment capture

    Send orders at payment capture, at the paid total.

  • 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 emit their own event and should reverse.

Written guarantee

95%+ tracking accuracy

Measured against Medusa orders by payment status, emitted from your own subscriber code.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Medusa → AppsFlyer questions, answered

From one of them, not both. The server event on payment capture is more reliable, but remove the SDK purchase event if you use it.

Free · 30 min

Get Medusa and AppsFlyer joined properly

Free30 minutesNo obligation