Skip to main content
LoyaltyLion → PostHogIntegration guide

Connecting LoyaltyLion to PostHog

LoyaltyLion is built around tiers, which means a customer's discount rate changes as they spend more — and so does the margin on every subsequent order. 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 LoyaltyLion tier 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

LoyaltyLion in PostHog: put tier on the purchase event itself

Send LoyaltyLion store orders to PostHog server-side through the capture API, with revenue net of the tier discount and the discount as its own property. Put the tier on each purchase event, set at order time, because a person property only holds today's tier. Use the Shopify customer ID as distinct_id at login and alias earlier anonymous browsing.

PostHog is a good place to study whether loyalty changes behavior, but how you store the tier decides whether the analysis is right. A person property holds the current tier, so a member who is Gold today looks Gold on purchases made back when they were Bronze. Add tier as an event property on every purchase, set from LoyaltyLion at the time of the order, so historical funnels describe what the customer actually had.

Identify members with the Shopify customer ID as the distinct_id once they log in, and alias the anonymous browsing that came before. Send orders server-side through the capture API with revenue net of tier discount and the discount as its own property. Then you can chart, per tier, how much margin the program gives away against how much more often members buy.

Track the loyalty widget too: opens, reward redemptions and referral link shares. Check whether LoyaltyLion's widget renders in your page DOM or an embedded frame; autocapture only sees the former. If the funnel shows heavy widget use with no change in repeat rate, that is useful to know before adding another tier.

LoyaltyLion → PostHog · what breaks

Why this join usually fails — LoyaltyLion → PostHog

  1. 01

    The distinct_id never reaches LoyaltyLion

    Tier benefits apply automatically at checkout, so the discount is inside the order rather than in a code.

  2. 02

    Tier discounts absorbed silently into order value

    Unlike a coupon, a tier discount has no code. It is applied automatically and disappears into the order total, so the margin erosion from a maturing loyalty base is invisible in every marketing report.

  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.

LoyaltyLion → PostHog · the fix

What working looks like — LoyaltyLion → PostHog

  • The distinct_id on every redemption

  • Conversions arriving in PostHog

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

  • Reconciled against the source

LoyaltyLion → PostHog · architecture

How LoyaltyLion and PostHog actually connect

  1. 1

    LoyaltyLion holds the truth

    A top-tier customer buys at a permanently lower margin. Their order value looks identical to a new customer's and is worth meaningfully less, which matters when you are deciding what a new customer is worth acquiring.

  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 LoyaltyLion tier order.

  4. 4

    The event source decides reliability

    Send orders net of tier discount, with the tier recorded so margin by cohort stays 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.

LoyaltyLion → PostHog · normal or broken

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

Normal, not a fault

  • The distinct_id present on the redemption

  • Sent from your order feed with tier attached

  • 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

    Tier benefits apply automatically at checkout, so the discount is inside the order rather than in a code.

  • Sent from the browser

    Unlike a coupon, a tier discount has no code. It is applied automatically and disappears into the order total, so the margin erosion from a maturing loyalty base is invisible in every marketing report.

  • 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

LoyaltyLion → PostHog · diagnose

Diagnostic order — LoyaltyLion → PostHog

  1. 01

    Count redemptions carrying the distinct_id

  2. 02

    Follow one real conversion end to end

  3. 03

    Compare average margin by loyalty tier

    As the programme matures this gap widens, and it is the reason a growing loyal base can coincide with falling profitability.

  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.

LoyaltyLion → PostHog · prove

How it gets proven — LoyaltyLion → PostHog

Source of truth

Store orders with the customer's loyalty tier recorded at the time of purchase.

  • The distinct_id confirmed present on a live redemption.
  • Purchase events reconciled per transaction against your billing system, with ingestion lag checked over the same window.
  • Orders reconciled net of tier discount against imported conversions, with tier recorded.

LoyaltyLion → PostHog · free audit

What we check in the free audit

  • Count redemptions carrying the distinct_id
  • Follow one real conversion end to end
  • Compare average margin by loyalty tier
  • Check ingestion health and disk before debugging any missing event
  • Read the match rate, not the success message

Checked against

Store orders with the customer's loyalty tier recorded at the time of purchase.

Get my free conversion tracking audit

Free30 minutesNo obligation

LoyaltyLion → PostHog · when not to buy

When you don't need this — LoyaltyLion → PostHog

  • Measure identifier coverage yourself first — pull your last hundred redemptions and count how many carry the distinct_id.
  • Flat-rate loyalty programmes without tiers do not have this problem.
  • 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.

LoyaltyLion → PostHog · what we deliver

What gets built — LoyaltyLion → PostHog

  • Identifier capture into LoyaltyLion

    Record the tier on the order and net tier discounts out of the reported value.

  • Event source: your order feed with tier attached

    Send orders net of tier discount, with the tier recorded so margin by cohort stays 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

    Refunds reverse.

Written guarantee

95%+ tracking accuracy

Measured against Store orders with the customer's loyalty tier recorded at the time of purchase.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

LoyaltyLion → PostHog questions, answered

As an event property on each purchase, set at order time, plus a person property for the current tier. The event property keeps history accurate.

Free · 30 min

Get LoyaltyLion and PostHog joined properly

Free30 minutesNo obligation