Skip to main content
Saleor → PostHogIntegration guide

Connecting Saleor to PostHog

Saleor is headless and GraphQL-first, which means the storefront and the commerce engine are separate applications and the identifier has to survive a boundary that traditional platforms do not have. PostHog can be self-hosted, which changes the calculus entirely: the data stays on infrastructure you control, and so does the responsibility for everything that goes wrong with it. The join between them succeeds or fails on one thing: whether the distinct_id reaches the Saleor order before the conversion happens, because PostHog can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

Saleor to PostHog: carry distinct_id through the checkout API

Write PostHog's distinct_id into Saleor checkout metadata, then send a purchase from the paid-order webhook to PostHog's capture API with that distinct_id, order number, total and currency, which guest checkout makes essential. Identify logged-in shoppers by Saleor user ID, use a deterministic order-derived event UUID against redeliveries, and send cancellations and refunds as separate events.

PostHog's JavaScript in your storefront knows the visitor by distinct_id; Saleor knows the order. To see a funnel that ends in a real paid order, not a confirmation page view, write the distinct_id into checkout metadata through the API and send a purchase from Saleor's paid-order webhook to PostHog's capture API with that distinct_id, the order number, total and currency. Guest checkout makes this essential: without it, a guest's purchase has no person to land on.

When a shopper logs in to a Saleor account, identify them in PostHog with the Saleor user ID so their anonymous browsing merges into one person. Use a deterministic event UUID derived from the order number, so Saleor webhook redeliveries do not record the order twice. Send cancellations and refunds as their own events so revenue insights can subtract them.

Running Saleor and PostHog both self-hosted keeps orders and product analytics on your own infrastructure, which is a real benefit. It also means two places an event can be lost. When a day's purchases look low in PostHog, compare against paid orders in Saleor for that day before changing any tracking code.

Saleor → PostHog · what breaks

Why this join usually fails — Saleor → PostHog

  1. 01

    The distinct_id never reaches Saleor

    The storefront holds the browser session; the commerce API holds the order. Nothing carries between them unless the storefront puts it there.

  2. 02

    A storefront that knows the click and an API that holds the money

    Headless architectures split exactly the two things attribution needs to join. If the storefront does not deliberately write the identifier into order metadata, the connection does not exist anywhere.

  3. 03

    Self-hosting the analytics and the outage together

    The advantage of owning the pipeline is that nothing blocks it. The cost is that when the ingestion instance fills its disk on a Saturday, the events are gone and nobody is paged. Hosted tools fail differently and more visibly.

  4. 04

    Nothing reconciles afterwards

    PostHog shows events in the activity view within moments. On a self-hosted instance, check the ingestion lag as well — events that are queued are not events that are lost, and the two need different responses.

Saleor → PostHog · the fix

What working looks like — Saleor → PostHog

  • The distinct_id on every order

  • Conversions arriving in PostHog

    The event lands on the person profile and becomes available in insights, funnels and session replay.

  • Reconciled against the source

Saleor → PostHog · architecture

How Saleor and PostHog actually connect

  1. 1

    Saleor holds the truth

    In a headless setup the storefront is one of several possible clients. Attributing from it means measuring one channel of a system designed to have many.

  2. 2

    PostHog needs a click to match

    PostHog needs a distinct_id, an event name and its properties. Self-hosted instances additionally need the ingestion endpoint reachable and the project API key correct, which is a class of failure hosted tools do not have.

  3. 3

    The identifier is the bridge

    The distinct_id, captured at the visit and carried into the Saleor order.

  4. 4

    The event source decides reliability

    Send fully paid orders at their net total, sourced from the API.

  5. 5

    Deduplication at the destination

    PostHog deduplicates on the event UUID where supplied. Without one, a retried batch duplicates, and on a self-hosted instance there is no vendor support desk to notice it for you.

Saleor → PostHog · normal or broken

Working vs. broken, side by side — Saleor → PostHog

Normal, not a fault

  • The distinct_id present on the order

  • Sent from the Saleor order webhook

  • Deduplicated correctly

    PostHog deduplicates on the event UUID where supplied. Without one, a retried batch duplicates, and on a self-hosted instance there is no vendor support desk to notice it for you.

  • Reconciles with the source

Actually broken

  • The distinct_id missing on most records

    The storefront holds the browser session; the commerce API holds the order. Nothing carries between them unless the storefront puts it there.

  • Sent from the browser

    Headless architectures split exactly the two things attribution needs to join. If the storefront does not deliberately write the identifier into order metadata, the connection does not exist anywhere.

  • Counted twice, or not at all

    The advantage of owning the pipeline is that nothing blocks it. The cost is that when the ingestion instance fills its disk on a Saturday, the events are gone and nobody is paged. Hosted tools fail differently and more visibly.

  • Nobody has reconciled it

Saleor → PostHog · diagnose

Diagnostic order — Saleor → PostHog

  1. 01

    Count orders carrying the distinct_id

  2. 02

    Follow one real conversion end to end

  3. 03

    Inspect order metadata on a live order for the identifier

    Either it is on the order or the attribution is guesswork. There is no middle state.

  4. 04

    Check ingestion health and disk before debugging any missing event

    On self-hosted instances the answer is infrastructure far more often than it is instrumentation.

  5. 05

    Read the match rate, not the success message

    PostHog shows events in the activity view within moments. On a self-hosted instance, check the ingestion lag as well — events that are queued are not events that are lost, and the two need different responses.

Saleor → PostHog · prove

How it gets proven — Saleor → PostHog

Source of truth

Saleor orders by payment status, read from the API rather than inferred from the storefront.

  • The distinct_id confirmed present on a live order.
  • Purchase events reconciled per transaction against your billing system, with ingestion lag checked over the same window.
  • Paid orders reconciled from the API against imported conversions.

Saleor → PostHog · free audit

What we check in the free audit

  • Count orders carrying the distinct_id
  • Follow one real conversion end to end
  • Inspect order metadata on a live order for the identifier
  • Check ingestion health and disk before debugging any missing event
  • Read the match rate, not the success message

Checked against

Saleor orders by payment status, read from the API rather than inferred from the storefront.

Get my free conversion tracking audit

Free30 minutesNo obligation

Saleor → PostHog · when not to buy

When you don't need this — Saleor → PostHog

  • Measure identifier coverage yourself first — pull your last hundred orders and count how many carry the distinct_id.
  • If you run a single storefront and no other clients, the added complexity of headless attribution buys you nothing over a standard integration.
  • If you have no reason to keep the data on your own infrastructure and no team to run it, the hosted product removes the only real downside of this one.

Saleor → PostHog · what we deliver

What gets built — Saleor → PostHog

  • Identifier capture into Saleor

    Capture in the storefront and write the identifier into order metadata through the API at checkout, so it lives on the order rather than in a session.

  • Event source: the Saleor order webhook

    Send fully paid orders at their net total, sourced from the API.

  • Dispatch to PostHog

    The PostHog capture API, posted server-side from your backend to your own instance or to PostHog Cloud.

  • Reversals where they exist

    Refunds and cancellations reverse.

Written guarantee

95%+ tracking accuracy

Measured against Saleor orders by payment status, read from the API rather than inferred from the storefront.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Saleor → PostHog questions, answered

Write PostHog's distinct_id into checkout metadata from the storefront, then send the purchase from the paid-order webhook with that distinct_id.

Free · 30 min

Get Saleor and PostHog joined properly

Free30 minutesNo obligation