Connecting Medusa to Mixpanel
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. Mixpanel is a product analytics tool, not an ad platform, which means it has no attribution model of its own and will faithfully report whatever event schema you give it — including a bad one. The join between them succeeds or fails on one thing: whether the distinct_id reaches the Medusa order before the conversion happens, because Mixpanel can only match a conversion it can tie back to a click it recognizes.
Free30 minutesNo obligation
Specific to this pair
Medusa to Mixpanel: identity in cart metadata, events in code
Write the storefront's distinct_id into Medusa cart metadata and identify with the customer ID at login, then send the purchase from the payment-capture subscriber with the order ID as $insert_id. Keep only one purchase event name. Add an automated test asserting the outgoing payload's distinct_id, event name and $insert_id.
Mixpanel's distinct_id is set by the storefront SDK, and the Medusa backend has never seen it. Write it into cart metadata when the cart is created or first updated, and call identify with the Medusa customer ID when the shopper logs in or registers. Your payment-capture subscriber then sends the purchase with that distinct_id, so it lands on the same profile as the browsing.
Use the order ID as $insert_id. Subscribers can be retried on failure, and without an insert ID a retry becomes a second purchase in Mixpanel's funnels. Agree the event name with the product team before writing it: if the storefront already fires a purchase-like event from the confirmation page, remove it or make the backend event the only one, or Mixpanel will treat the two names as unrelated events.
Medusa gives you something most stores cannot have: an automated test for tracking. Write one that completes a cart with known metadata, captures a test payment and asserts that the outgoing Mixpanel payload has the right distinct_id, event name and $insert_id. It is a few lines in your own repo, and it catches the regression that otherwise shows up as a broken funnel a month after a storefront redesign.
Medusa → Mixpanel · what breaks
Why this join usually fails — Medusa → Mixpanel
- 01
The distinct_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.
- 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.
- 03
One event schema, two teams, no agreement
Marketing names an event Purchase, the product team names it purchase_completed, and both are sent. Mixpanel treats them as unrelated, every funnel silently splits, and two teams spend a quarter arguing about which number is right when both are.
- 04
Nothing reconciles afterwards
Mixpanel shows events in the live view within moments. Check that the distinct_id matches the signed-in user rather than a lingering anonymous ID, because that is the failure that quietly breaks every cross-signup funnel.
Medusa → Mixpanel · the fix
What working looks like — Medusa → Mixpanel
The distinct_id on every order
Conversions arriving in Mixpanel
The event lands on the user profile and becomes available in funnels, retention and cohort analysis.
Reconciled against the source
Medusa → Mixpanel · architecture
How Medusa and Mixpanel actually connect
- 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
Mixpanel needs a click to match
Mixpanel needs a distinct_id, an event name and its properties. Events without a distinct_id are rejected; events with the wrong one land on a stranger's profile.
- 3
The identifier is the bridge
The distinct_id, captured at the visit and carried into the Medusa order.
- 4
The event source decides reliability
Send orders at payment capture, at the paid total.
- 5
Deduplication at the destination
Mixpanel deduplicates on $insert_id within a time window. Without it, a retried server request creates a second event, and because Mixpanel is where product decisions get made, that inflation ends up in a roadmap rather than in an ad report.
Medusa → Mixpanel · normal or broken
Working vs. broken, side by side — Medusa → Mixpanel
Normal, not a fault
The distinct_id present on the order
Sent from a Medusa subscriber on order payment capture
Deduplicated correctly
Mixpanel deduplicates on $insert_id within a time window. Without it, a retried server request creates a second event, and because Mixpanel is where product decisions get made, that inflation ends up in a roadmap rather than in an ad report.
Reconciles with the source
Actually broken
The distinct_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
Marketing names an event Purchase, the product team names it purchase_completed, and both are sent. Mixpanel treats them as unrelated, every funnel silently splits, and two teams spend a quarter arguing about which number is right when both are.
Nobody has reconciled it
Medusa → Mixpanel · diagnose
Diagnostic order — Medusa → Mixpanel
- 01
Count orders carrying the distinct_id
- 02
Follow one real conversion end to end
- 03
Check which event your subscriber listens to
One line of code, and it decides whether you are counting orders or counting money.
- 04
List every event name in the project and look for near-duplicates
Case differences, tense differences and synonyms are the usual finding, and they are cheap to fix before a year of data is built on them.
- 05
Read the match rate, not the success message
Mixpanel shows events in the live view within moments. Check that the distinct_id matches the signed-in user rather than a lingering anonymous ID, because that is the failure that quietly breaks every cross-signup funnel.
Medusa → Mixpanel · prove
How it gets proven — Medusa → Mixpanel
Source of truth
Medusa orders by payment status, emitted from your own subscriber code.
- The distinct_id confirmed present on a live order.
- Purchase events reconciled per transaction against your billing system, with identity aliasing verified across the signup boundary.
- Payment-captured orders reconciled against imported conversions.
Medusa → Mixpanel · free audit
What we check in the free audit
- Count orders carrying the distinct_id
- Follow one real conversion end to end
- Check which event your subscriber listens to
- List every event name in the project and look for near-duplicates
- Read the match rate, not the success message
Checked against
Medusa orders by payment status, emitted from your own subscriber code.
Free30 minutesNo obligation
Medusa → Mixpanel · when not to buy
When you don't need this — Medusa → Mixpanel
- Measure identifier coverage yourself first — pull your last hundred orders and count how many carry the distinct_id.
- If every payment method you accept is instant, the two events nearly coincide and the distinction costs more than it returns.
- If you already have the same events in a warehouse and nobody is running product analysis on them, adding Mixpanel adds a second source of truth rather than an answer.
Medusa → Mixpanel · what we deliver
What gets built — Medusa → Mixpanel
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 Mixpanel
The Mixpanel ingestion API, posted server-side from your backend with the distinct_id and event 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.
From $400 · See packages
FAQ
Medusa → Mixpanel questions, answered
From backend subscribers posting to Mixpanel's ingestion API, using the distinct_id the storefront stored in cart metadata. Fire purchases on payment capture, not order placement.
Check the plugin and module listings for your Medusa version. Many teams write a small subscriber instead, because it is easy to test.
Almost always because the distinct_id never reached the Medusa order. The storefront is separate from the backend, and the identifier must be attached to the cart before the order is created. Measure coverage before debugging the dispatch.
Mixpanel identifies people by distinct_id, which starts as an anonymous device value and should be aliased to your own user ID at signup. Getting that alias wrong is the single most common Mixpanel implementation failure: the anonymous pre-signup activity and the identified user become two separate people, and every funnel that crosses signup is broken.
A Medusa subscriber on order payment capture. Send orders at payment capture, at the paid total.
Mixpanel shows events in the live view within moments. Check that the distinct_id matches the signed-in user rather than a lingering anonymous ID, because that is the failure that quietly breaks every cross-signup funnel.
More on Medusa → Mixpanel
- Stripe → MixpanelConnecting Stripe to Mixpanel
- PayPal → MixpanelConnecting PayPal to Mixpanel
- Shopify → MixpanelConnecting Shopify to Mixpanel
RELATED GUIDES
Where Medusa → Mixpanel fits in the rest of your tracking
- Squarespace → MixpanelConnecting Squarespace Commerce to Mixpanel
- Gumroad → MixpanelConnecting Gumroad to Mixpanel
- Magento → MixpanelConnecting Magento to Mixpanel
- Medusa → GA4Connecting Medusa to GA4
- Medusa → Adobe AnalyticsConnecting Medusa to Adobe Analytics
- Furniture ecommerceConversion tracking for furniture ecommerce, measured after delivery
- OpenCart → MixpanelConnecting OpenCart to Mixpanel
- Shopify → MixpanelConnecting Shopify to Mixpanel
Free · 30 min
Get Medusa and Mixpanel joined properly
Free30 minutesNo obligation
