Skip to main content
Medusa → AmplitudeIntegration guide

Connecting Medusa to Amplitude

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. Amplitude is built around behavioural cohorts, which makes the identity resolution and the event taxonomy load-bearing in a way they never are for an ad pixel. The join between them succeeds or fails on one thing: whether the user ID and device ID pair reaches the Medusa order before the conversion happens, because Amplitude can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

Medusa to Amplitude: revenue events from your own subscriber

Write Amplitude's device_id into Medusa cart metadata and send the customer ID as user_id after login, then post purchases from a payment-capture subscriber with price and quantity and the order ID as insert_id. Check whether your Medusa version stores money in smallest units or decimals, add negative-revenue refunds, and check for an existing analytics provider.

With Medusa you write the code that sends to Amplitude, so the decisions are yours to get right. Identity first: the storefront's Amplitude SDK assigns a device_id; write it into cart metadata when the cart is created, next to the click IDs, and once the shopper logs in, send the Medusa customer ID as user_id. Your payment-capture subscriber then reads both off the order and posts to Amplitude's HTTP API, so the purchase lands on the user who browsed.

Amplitude fills revenue charts only if price and quantity, or revenue, are populated. Check how your Medusa version represents money: older versions store integers in the currency's smallest unit, newer ones store decimal amounts, and dividing by 100 on the wrong version is an easy factor-of-100 error. Use the order ID as insert_id, decide with the product team whether to send one event per line item or per order, and add a refund subscriber that sends negative revenue.

Newer Medusa versions include an analytics module with pluggable providers. Check whether your version has an Amplitude provider before writing your own client, and if you use one, confirm it sends from payment capture rather than order placement, since the gap holds every failed payment.

Medusa → Amplitude · what breaks

Why this join usually fails — Medusa → Amplitude

  1. 01

    The user ID and device ID pair 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

    Revenue events that carry no revenue

    Amplitude will happily accept a purchase event with no price field. The event count looks correct, the funnel looks correct, and the revenue reporting stays at zero — which people usually discover a quarter later when someone asks what a cohort is worth.

  4. 04

    Nothing reconciles afterwards

    Amplitude shows the event in the user's activity stream with its properties expanded. Read the properties, because an event that arrives without its revenue fields still looks like a success.

Medusa → Amplitude · the fix

What working looks like — Medusa → Amplitude

  • The user ID and device ID pair on every order

  • Conversions arriving in Amplitude

    The event lands on the user, joins their behavioural history, and becomes available for cohorts, funnels and retention.

  • Reconciled against the source

Medusa → Amplitude · architecture

How Medusa and Amplitude 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

    Amplitude needs a click to match

    Amplitude needs a device or user identifier, an event type and its properties. Revenue events need the price and quantity fields specifically, or the revenue reporting stays empty while events flow normally.

  3. 3

    The identifier is the bridge

    The user ID and device ID pair, 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

    Amplitude deduplicates on insert_id. Omit it and a retried batch is counted twice, which shows up as a phantom spike that someone will eventually build a hypothesis on.

Medusa → Amplitude · normal or broken

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

Normal, not a fault

  • The user ID and device ID pair present on the order

  • Sent from a Medusa subscriber on order payment capture

  • Deduplicated correctly

    Amplitude deduplicates on insert_id. Omit it and a retried batch is counted twice, which shows up as a phantom spike that someone will eventually build a hypothesis on.

  • Reconciles with the source

Actually broken

  • The user ID and device ID pair 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

    Amplitude will happily accept a purchase event with no price field. The event count looks correct, the funnel looks correct, and the revenue reporting stays at zero — which people usually discover a quarter later when someone asks what a cohort is worth.

  • Nobody has reconciled it

Medusa → Amplitude · diagnose

Diagnostic order — Medusa → Amplitude

  1. 01

    Count orders carrying the user ID and device ID pair

  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 a purchase event for the price and quantity fields specifically

    Not whether the event arrived — whether the revenue fields are populated, in the exact names Amplitude expects.

  5. 05

    Read the match rate, not the success message

    Amplitude shows the event in the user's activity stream with its properties expanded. Read the properties, because an event that arrives without its revenue fields still looks like a success.

Medusa → Amplitude · prove

How it gets proven — Medusa → Amplitude

Source of truth

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

  • The user ID and device ID pair confirmed present on a live order.
  • Revenue reconciled per transaction against your billing system, with identity merge behaviour verified across signup.
  • Payment-captured orders reconciled against imported conversions.

Medusa → Amplitude · free audit

What we check in the free audit

  • Count orders carrying the user ID and device ID pair
  • Follow one real conversion end to end
  • Check which event your subscriber listens to
  • Check a purchase event for the price and quantity fields specifically
  • 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 → Amplitude · when not to buy

When you don't need this — Medusa → Amplitude

  • Measure identifier coverage yourself first — pull your last hundred orders and count how many carry the user ID and device ID pair.
  • If every payment method you accept is instant, the two events nearly coincide and the distinction costs more than it returns.
  • If nobody is building cohorts or retention analysis, this is a large amount of instrumentation for reporting a dashboard already gives you.

Medusa → Amplitude · what we deliver

What gets built — Medusa → Amplitude

  • 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 Amplitude

    The Amplitude HTTP V2 API, posted server-side with the identity, event type and properties.

  • 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 → Amplitude questions, answered

Write a subscriber on payment capture that posts to Amplitude's HTTP API with the device_id and user_id stored in cart metadata, and the price and quantity fields populated.

Free · 30 min

Get Medusa and Amplitude joined properly

Free30 minutesNo obligation