Connecting AfterSell to PostHog
AfterSell works through checkout extensions and post-purchase pages, which puts its offers inside Shopify's sandboxed surfaces where your own scripts cannot reach. 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 AfterSell upsell 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
AfterSell in PostHog: measure what upsell takers do next
PostHog cannot see AfterSell offers because the post-purchase page is sandboxed. Store the visitor's PostHog distinct_id on the cart, then capture an order event server-side after the offer is answered, with that distinct_id, the final total and the accepted offer as properties, plus an event UUID so a retried webhook does not log the order twice.
PostHog cannot see AfterSell's offers. Checkout extensions and the post-purchase page are sandboxed, so posthog-js on the storefront records the visitor up to checkout and nothing about the offer. The data has to come from the order: store the visitor's distinct_id on the cart, then capture an order event server-side after the post-purchase offer is answered, with that distinct_id, the final total and the accepted offer as properties.
That gives PostHog the question AfterSell's own reporting does not answer: what happens to upsell takers afterwards. Compare refund rate, repeat purchase and support contacts for customers who accepted an offer against those who declined, over ninety days. A post-purchase offer that lifts average order value and also lifts returns is not the win its dashboard suggests.
If you split-test offers inside AfterSell, do not run a competing PostHog experiment on the same surface; you cannot evaluate a flag inside the sandbox anyway. Use PostHog to read longer-term outcomes by offer, which means recording the offer on the order if AfterSell exposes it. Supply an event UUID so a retried webhook does not log the order twice.
AfterSell → PostHog · what breaks
Why this join usually fails — AfterSell → PostHog
- 01
The distinct_id never reaches AfterSell
Extension surfaces are isolated by design. Attempting to instrument them client-side does not work and is not supported.
- 02
Trying to instrument a sandbox
Time gets spent attempting to observe checkout extension behaviour from the storefront. It cannot be done, by design, and every hour spent on it is an hour not spent on the server-side path that works.
- 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.
- 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.
AfterSell → PostHog · the fix
What working looks like — AfterSell → 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
AfterSell → PostHog · architecture
How AfterSell and PostHog actually connect
- 1
AfterSell holds the truth
Checkout UI extensions run sandboxed. Nothing you write can observe them, so the only reliable view of what the customer accepted is the order itself.
- 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
The identifier is the bridge
The distinct_id, captured at the visit and carried into the AfterSell upsell order.
- 4
The event source decides reliability
Send the final order total from the webhook, with upsell line items identified.
- 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.
AfterSell → PostHog · normal or broken
Working vs. broken, side by side — AfterSell → PostHog
Normal, not a fault
The distinct_id present on the order
Sent from the Shopify 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
Extension surfaces are isolated by design. Attempting to instrument them client-side does not work and is not supported.
Sent from the browser
Time gets spent attempting to observe checkout extension behaviour from the storefront. It cannot be done, by design, and every hour spent on it is an hour not spent on the server-side path that works.
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
AfterSell → PostHog · diagnose
Diagnostic order — AfterSell → PostHog
- 01
Count orders carrying the distinct_id
- 02
Follow one real conversion end to end
- 03
Confirm the conversion is sourced from the order, not from a page
On modern Shopify checkout there is no supported page-based option left, so this is the only correct architecture.
- 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.
- 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.
AfterSell → PostHog · prove
How it gets proven — AfterSell → PostHog
Source of truth
The final Shopify order total, read from the order record.
- 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.
- Final order totals reconciled from the webhook against imported conversions.
AfterSell → PostHog · free audit
What we check in the free audit
- Count orders carrying the distinct_id
- Follow one real conversion end to end
- Confirm the conversion is sourced from the order, not from a page
- Check ingestion health and disk before debugging any missing event
- Read the match rate, not the success message
Checked against
The final Shopify order total, read from the order record.
Free30 minutesNo obligation
AfterSell → PostHog · when not to buy
When you don't need this — AfterSell → PostHog
- Measure identifier coverage yourself first — pull your last hundred orders and count how many carry the distinct_id.
- If your conversions already come from the order webhook, checkout extensions change nothing for you.
- 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.
AfterSell → PostHog · what we deliver
What gets built — AfterSell → PostHog
Identifier capture into AfterSell
Do not try to instrument the checkout surface. Read the order server-side, which is the supported and more reliable path anyway.
Event source: the Shopify order webhook
Send the final order total from the webhook, with upsell line items identified.
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 reverse.
Written guarantee
95%+ tracking accuracy
Measured against The final Shopify order total, read from the order record.. Miss it and we keep working at no cost.
From $400 · See packages
FAQ
AfterSell → PostHog questions, answered
Not in the browser; the offer page is sandboxed. Send an order event server-side with the accepted offer as a property and the distinct_id stored on the cart.
Send orders and refunds to PostHog with the accepted-offer property, then compare refund rates between customers who accepted and those who declined.
Almost always because the distinct_id never reached the AfterSell upsell order. Extension surfaces are isolated by design. Attempting to instrument them client-side does not work and is not supported. Measure coverage before debugging the dispatch.
PostHog identifies by distinct_id with an alias call to merge anonymous and identified users. On a self-hosted instance you also control the ingestion endpoint, which means the identifier survives ad blockers that would kill a third-party pixel — one of the few genuine technical advantages available to a first-party setup.
The Shopify order webhook. Send the final order total from the webhook, with upsell line items identified.
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.
More on AfterSell → PostHog
- Stripe → PostHogConnecting Stripe to PostHog
- PayPal → PostHogConnecting PayPal to PostHog
- Shopify → PostHogConnecting Shopify to PostHog
RELATED GUIDES
Where AfterSell → PostHog fits in the rest of your tracking
- ReConvert → PostHogConnecting ReConvert to PostHog
- Checkout Champ → PostHogConnecting Checkout Champ to PostHog
- Rebuy → PostHogConnecting Rebuy to PostHog
- AfterSell → AmplitudeConnecting AfterSell to Amplitude
- AfterSell → MatomoConnecting AfterSell to Matomo
- FashionConversion tracking for fashion brands, reported net of returns
- CartHook → PostHogConnecting CartHook to PostHog
- Zipify OCU → PostHogConnecting Zipify OneClickUpsell to PostHog
Free · 30 min
Get AfterSell and PostHog joined properly
Free30 minutesNo obligation
