Skip to main content
Afterpay → PostHogIntegration guide

Connecting Afterpay to PostHog

Afterpay is pay-in-four buy-now-pay-later, which means the shopper is approved elsewhere and the merchant is paid up front by the provider. 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 Afterpay 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

Afterpay in PostHog: see the approval drop-off, not just the order

Capture checkout started and payment method selected in the browser with the distinct_id, write it onto the order before the Afterpay redirect, and send the order server-side with the same distinct_id and an event UUID. That separates approved non-returners from declines. Add payment method and order value as properties, and use the server order as any experiment's goal.

PostHog is where the Afterpay redirect can be measured rather than merely survived. Capture checkout started and payment method selected in the browser with the visitor's distinct_id, write that distinct_id onto the order before the redirect, and send the order server-side with the same distinct_id. The funnel then shows how many shoppers chose Afterpay, how many came back with an order, and how many vanished at the approval step.

That last group contains two kinds of people: those Afterpay declined and those approved who never came back. Only the second has an order, which is why the server event matters; without it, approved shoppers who closed the tab look like declines and BNPL drop-off looks worse than it is. Add payment method and order value as properties so the funnel can be broken down by cart size, since approval odds change with basket value.

The pay-in-four messaging on product pages is a reasonable thing to test with a PostHog experiment, but only if the goal metric is the server-side order event. A browser-fired purchase would undercount the Afterpay arm specifically and bias the result against the messaging you are testing. Pass an event UUID on the server event so a retried webhook does not create a second order.

Afterpay → PostHog · what breaks

Why this join usually fails — Afterpay → PostHog

  1. 01

    The distinct_id never reaches Afterpay

    The shopper is redirected to Afterpay for approval and a meaningful share never return to the confirmation page. The order exists and no pixel fired.

  2. 02

    The approval redirect that ends the session

    Approval happens on Afterpay's side. The customer is committed, the merchant is paid, and the confirmation page is optional from the shopper's point of view.

  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.

Afterpay → PostHog · the fix

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

Afterpay → PostHog · architecture

How Afterpay and PostHog actually connect

  1. 1

    Afterpay holds the truth

    Afterpay pays the merchant in full and collects instalments from the shopper itself, so your revenue arrives at once even though the customer pays over time. The store's order record is the money event, not the instalment schedule.

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

  4. 4

    The event source decides reliability

    Fire from the order record, which exists whether or not the browser came back, and tag the payment method so BNPL performance is visible.

  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.

Afterpay → PostHog · normal or broken

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

Normal, not a fault

  • The distinct_id present on the order

  • Sent from your store's 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 shopper is redirected to Afterpay for approval and a meaningful share never return to the confirmation page. The order exists and no pixel fired.

  • Sent from the browser

    Approval happens on Afterpay's side. The customer is committed, the merchant is paid, and the confirmation page is optional from the shopper's point of view.

  • 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

Afterpay → PostHog · diagnose

Diagnostic order — Afterpay → PostHog

  1. 01

    Count orders carrying the distinct_id

  2. 02

    Follow one real conversion end to end

  3. 03

    Count Afterpay checkouts started against confirmation-page loads

    The gap is the share of BNPL revenue a browser-side setup cannot see, and it is usually larger than merchants expect.

  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.

Afterpay → PostHog · prove

How it gets proven — Afterpay → PostHog

Source of truth

Your store's orders paid with Afterpay, cross-checked against Afterpay's settlement.

  • 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.
  • An Afterpay order abandoned at the return step, confirmed to still report.

Afterpay → PostHog · free audit

What we check in the free audit

  • Count orders carrying the distinct_id
  • Follow one real conversion end to end
  • Count Afterpay checkouts started against confirmation-page loads
  • Check ingestion health and disk before debugging any missing event
  • Read the match rate, not the success message

Checked against

Your store's orders paid with Afterpay, cross-checked against Afterpay's settlement.

Get my free conversion tracking audit

Free30 minutesNo obligation

Afterpay → PostHog · when not to buy

When you don't need this — Afterpay → PostHog

  • Measure identifier coverage yourself first — pull your last hundred orders and count how many carry the distinct_id.
  • If BNPL is a very small share of your orders, measure that share before commissioning anything.
  • 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.

Afterpay → PostHog · what we deliver

What gets built — Afterpay → PostHog

  • Identifier capture into Afterpay

    Capture the identifier before checkout and store it on the order in your own system, so the conversion does not depend on the shopper completing the return journey.

  • Event source: your store's order webhook

    Fire from the order record, which exists whether or not the browser came back, and tag the payment method so BNPL performance is visible.

  • 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

    Returns on BNPL orders run higher than card in many stores, so the reversal matters more here than elsewhere.

Written guarantee

95%+ tracking accuracy

Measured against Your store's orders paid with Afterpay, cross-checked against Afterpay's settlement.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Afterpay → PostHog questions, answered

Fire browser events up to the redirect and a server-side order event with the same distinct_id. The gap between the Afterpay step and the order event is your approval and return loss.

Free · 30 min

Get Afterpay and PostHog joined properly

Free30 minutesNo obligation