Skip to main content
CartHook → PostHogIntegration guide

Connecting CartHook to PostHog

CartHook does post-purchase one-click upsells specifically, which means every pound it adds arrives after the order was created and after any checkout-time conversion already fired. 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 CartHook post-purchase 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

CartHook to PostHog: a funnel for the offer, captured server-side

CartHook's post-purchase page runs inside Shopify's checkout, where PostHog's snippet doesn't, so send offer events server-side once the offer window closes. Write the PostHog distinct_id to a cart attribute so the order webhook sends purchase and upsell-accepted events to the same person, with UUIDs derived from the Shopify order number and the settled value on purchase.

PostHog is the right place to answer product questions about the offer itself: how many buyers saw it, how many accepted, and whether acceptance varies by landing page or traffic source. The difficulty is that the post-purchase page sits inside Shopify's checkout, where your PostHog snippet does not run the way it does on the storefront. Offer events therefore have to come from the server, from CartHook's data or from the Shopify order once the offer window closes.

Joining those server events to the session means carrying the distinct_id into the order. Read it from the PostHog library on the storefront and write it to the cart as an attribute, so the order webhook can send purchase and upsell-accepted events against the same person. Derive each event's UUID deterministically from the Shopify order number, so a webhook retry does not create a second purchase.

Check whether CartHook exposes offer views and declines through a webhook or export. If not, PostHog only sees acceptances, which show up as order edits, and the funnel's denominator becomes every completed order rather than every offer shown. That is still useful, just narrower. Put the settled order value on the purchase event so revenue insights match Shopify.

CartHook → PostHog · what breaks

Why this join usually fails — CartHook → PostHog

  1. 01

    The distinct_id never reaches CartHook

    The offer runs after order creation, so anything that fired at checkout has already gone.

  2. 02

    Upsell revenue that no campaign ever gets credit for

    If the conversion fires at checkout, every pound the upsell adds is invisible. The campaigns bringing buyers most receptive to upsells look identical to those bringing the least receptive.

  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.

CartHook → PostHog · the fix

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

CartHook → PostHog · architecture

How CartHook and PostHog actually connect

  1. 1

    CartHook holds the truth

    A one-click upsell charges the stored payment method and appends to the same order. The order total changes; the checkout total does not.

  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 CartHook post-purchase order.

  4. 4

    The event source decides reliability

    Send the settled order total, with upsell contribution recorded separately so take rate is visible per campaign.

  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.

CartHook → PostHog · normal or broken

Working vs. broken, side by side — CartHook → 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

    The offer runs after order creation, so anything that fired at checkout has already gone.

  • Sent from the browser

    If the conversion fires at checkout, every pound the upsell adds is invisible. The campaigns bringing buyers most receptive to upsells look identical to those bringing the least receptive.

  • 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

CartHook → PostHog · diagnose

Diagnostic order — CartHook → PostHog

  1. 01

    Count orders carrying the distinct_id

  2. 02

    Follow one real conversion end to end

  3. 03

    Compare checkout total against final settled total

    The gap is the revenue your conversion reporting is currently discarding.

  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.

CartHook → PostHog · prove

How it gets proven — CartHook → PostHog

Source of truth

The final Shopify order total after the post-purchase sequence completes.

  • 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.
  • Settled order totals reconciled against imported conversions for a closed week.

CartHook → PostHog · free audit

What we check in the free audit

  • Count orders carrying the distinct_id
  • Follow one real conversion end to end
  • Compare checkout total against final settled total
  • 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 after the post-purchase sequence completes.

Get my free conversion tracking audit

Free30 minutesNo obligation

CartHook → PostHog · when not to buy

When you don't need this — CartHook → PostHog

  • Measure identifier coverage yourself first — pull your last hundred orders and count how many carry the distinct_id.
  • Stores without post-purchase offers can report checkout value and the timing question does not arise.
  • 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.

CartHook → PostHog · what we deliver

What gets built — CartHook → PostHog

  • Identifier capture into CartHook

    Send the conversion from the order webhook once the post-purchase window closes, rather than at checkout.

  • Event source: the Shopify order webhook

    Send the settled order total, with upsell contribution recorded separately so take rate is visible per campaign.

  • 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; an upsell-only refund should reduce rather than reverse the order.

Written guarantee

95%+ tracking accuracy

Measured against The final Shopify order total after the post-purchase sequence completes.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

CartHook → PostHog questions, answered

Acceptances, yes, from the Shopify order once it is edited. Views and declines need data from CartHook, so check what it exports.

Free · 30 min

Get CartHook and PostHog joined properly

Free30 minutesNo obligation