Skip to main content
Medusa → MatomoIntegration guide

Connecting Medusa to Matomo

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. Matomo can be self-hosted with no third party in the chain, which makes it the one analytics destination where the data genuinely never leaves infrastructure you control. The join between them succeeds or fails on one thing: whether the first-party visitor ID reaches the Medusa order before the conversion happens, because Matomo can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

Medusa to Matomo: self-hosted orders joined to the visit

Write Matomo's visitor ID into Medusa cart metadata, then have the payment-capture subscriber send an ecommerce order through the HTTP Tracking API with the order ID, paid total and line items, keeping the auth token on the backend. Check whether your version stores smallest currency units, reuse the order ID in browser tracking, and track refunds separately.

Medusa and a self-hosted Matomo is about the only commerce setup where both ends of the conversion live on infrastructure you run, which suits stores with strict privacy commitments. The join is Matomo's 16-character visitor ID from the storefront's first-party cookie. Read it in the storefront when the cart is created, write it into cart metadata, and have the payment-capture subscriber send an ecommerce order through the HTTP Tracking API with that visitor ID, the Medusa order ID as the order identifier, the paid total and the line items. Overrides such as the visit timestamp need an authenticated request with a token, so keep that token on the backend only.

Two Medusa-specific checks. First, amounts: Medusa v1 stored totals in the smallest currency unit, and Matomo expects revenue in normal units, so a missing division turns a $48 order into $4,800. Confirm how your version stores totals. Second, if the storefront also tracks the order on the confirmation page, use the same order ID in both; Matomo then keeps one.

Matomo has no clean reversal for an ecommerce order already recorded. Report Medusa refunds in a separate refund goal or reconcile them outside Matomo, rather than expecting the revenue report to net them off automatically.

Medusa → Matomo · what breaks

Why this join usually fails — Medusa → Matomo

  1. 01

    The first-party visitor 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

    Owning the pipeline means owning the outage

    The advantage is that nothing blocks it. The cost is that when the tracking database fills or falls behind on a weekend, the data is gone and no vendor is paging anyone. Hosted tools fail more visibly.

  4. 04

    Nothing reconciles afterwards

    Matomo exposes raw visit logs, so you can inspect the actual hit rather than an aggregate. Check the log, and check ingestion lag alongside it.

Medusa → Matomo · the fix

What working looks like — Medusa → Matomo

  • The first-party visitor ID on every order

  • Conversions arriving in Matomo

    The event lands in your own database and is queryable directly, including the raw log, which most analytics products do not expose.

  • Reconciled against the source

Medusa → Matomo · architecture

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

    Matomo needs a click to match

    The site ID, the visitor identifier and the event or ecommerce order. Self-hosted instances additionally need the tracker endpoint reachable and the database keeping up, which hosted tools do not fail at.

  3. 3

    The identifier is the bridge

    The first-party visitor 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

    Matomo deduplicates ecommerce orders on order ID. Without one, a refreshed confirmation page records a second order.

Medusa → Matomo · normal or broken

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

Normal, not a fault

  • The first-party visitor ID present on the order

  • Sent from a Medusa subscriber on order payment capture

  • Deduplicated correctly

    Matomo deduplicates ecommerce orders on order ID. Without one, a refreshed confirmation page records a second order.

  • Reconciles with the source

Actually broken

  • The first-party visitor 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

    The advantage is that nothing blocks it. The cost is that when the tracking database fills or falls behind on a weekend, the data is gone and no vendor is paging anyone. Hosted tools fail more visibly.

  • Nobody has reconciled it

Medusa → Matomo · diagnose

Diagnostic order — Medusa → Matomo

  1. 01

    Count orders carrying the first-party visitor 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 tracker reachability and database lag before debugging any tag

    On self-hosted analytics the answer is infrastructure more often than instrumentation.

  5. 05

    Read the match rate, not the success message

    Matomo exposes raw visit logs, so you can inspect the actual hit rather than an aggregate. Check the log, and check ingestion lag alongside it.

Medusa → Matomo · prove

How it gets proven — Medusa → Matomo

Source of truth

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

  • The first-party visitor ID confirmed present on a live order.
  • Orders reconciled against the Matomo ecommerce log with order-ID deduplication verified.
  • Payment-captured orders reconciled against imported conversions.

Medusa → Matomo · free audit

What we check in the free audit

  • Count orders carrying the first-party visitor ID
  • Follow one real conversion end to end
  • Check which event your subscriber listens to
  • Check tracker reachability and database lag before debugging any tag
  • 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 → Matomo · when not to buy

When you don't need this — Medusa → Matomo

  • Measure identifier coverage yourself first — pull your last hundred orders and count how many carry the first-party visitor 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 privacy or ownership requirement and no team to run it, a hosted product removes the only real cost of this one.

Medusa → Matomo · what we deliver

What gets built — Medusa → Matomo

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

    The Matomo HTTP Tracking API, posted server-side from your order system.

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

Yes, through Matomo's HTTP Tracking API from a subscriber. The key is passing the visitor ID captured on the storefront, or the order lands as a new visit with no source.

Free · 30 min

Get Medusa and Matomo joined properly

Free30 minutesNo obligation