Skip to main content
LearnDash → PostHogIntegration guide

Connecting LearnDash to PostHog

LearnDash runs courses inside WordPress, which means enrolment can happen through a purchase, a membership, a manual grant or a coupon — and only one of those is revenue. 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 LearnDash enrolment 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

PostHog for LearnDash: funnels from first lesson to completion

To track LearnDash in PostHog, identify learners with the WordPress user ID at login, then capture enrolled (with access source and price), lesson started and completed, quiz results and course completed server-side from LearnDash hooks. Set access source as a person property, and send paid enrollments from the server rather than a Stripe or PayPal return page.

PostHog suits LearnDash sites that care about what learners do after they pay. Course businesses lose revenue to refunds and non-completion more than to weak acquisition, and PostHog's funnels and retention charts show where it happens. Identify each learner with the WordPress user ID at login so anonymous visits before signup merge into the same person.

Capture LearnDash's lifecycle server-side from its hooks: enrolled, with access source and price; lesson started; lesson completed; quiz passed or failed; course completed. Set the course ID as an event property and the learner's access source as a person property, so you can compare completion between learners who paid, learners enrolled by their employer and learners on a free course. Mixing them hides the fact that paid learners often behave very differently.

The checkout hop is where the person splits. If LearnDash hands the buyer to a hosted Stripe or PayPal page, the browser returns with the same PostHog cookie, but only if the return lands on your domain. Send the paid enrollment from the server with the WordPress user ID, not from the return page. If you self-host PostHog, check ingestion lag before chasing missing lesson events on busy cohort launch days.

LearnDash → PostHog · what breaks

Why this join usually fails — LearnDash → PostHog

  1. 01

    The distinct_id never reaches LearnDash

    Checkout runs through whichever WooCommerce or membership plugin is attached, so the identifier has to survive an extra handoff.

  2. 02

    Granted access counted as sales

    An admin enrolling a cohort, a membership granting bundled access and a coupon at one hundred percent all produce enrolment records identical to a paid one. Counting them inflates revenue by whatever your free access volume is.

  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.

LearnDash → PostHog · the fix

What working looks like — LearnDash → PostHog

  • The distinct_id on every enrolment

  • Conversions arriving in PostHog

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

  • Reconciled against the source

LearnDash → PostHog · architecture

How LearnDash and PostHog actually connect

  1. 1

    LearnDash holds the truth

    LearnDash enrols users from several sources. Course access granted by a membership plugin or by an admin is not a sale and must not be counted as one.

  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 LearnDash enrolment.

  4. 4

    The event source decides reliability

    Send paid enrolments at the amount charged. Free and granted enrolments carry no value.

  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.

LearnDash → PostHog · normal or broken

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

Normal, not a fault

  • The distinct_id present on the enrolment

  • Sent from the payment record joined to the enrolment

  • 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

    Checkout runs through whichever WooCommerce or membership plugin is attached, so the identifier has to survive an extra handoff.

  • Sent from the browser

    An admin enrolling a cohort, a membership granting bundled access and a coupon at one hundred percent all produce enrolment records identical to a paid one. Counting them inflates revenue by whatever your free access volume is.

  • 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

LearnDash → PostHog · diagnose

Diagnostic order — LearnDash → PostHog

  1. 01

    Count enrolments carrying the distinct_id

  2. 02

    Follow one real conversion end to end

  3. 03

    Split enrolments by how access was granted

    One field, and on established course sites the free share is usually larger than expected.

  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.

LearnDash → PostHog · prove

How it gets proven — LearnDash → PostHog

Source of truth

Paid enrolments from your payment system, held apart from free and granted access.

  • The distinct_id confirmed present on a live enrolment.
  • Purchase events reconciled per transaction against your billing system, with ingestion lag checked over the same window.
  • Paid enrolments reconciled at charged amounts against imported conversions.

LearnDash → PostHog · free audit

What we check in the free audit

  • Count enrolments carrying the distinct_id
  • Follow one real conversion end to end
  • Split enrolments by how access was granted
  • Check ingestion health and disk before debugging any missing event
  • Read the match rate, not the success message

Checked against

Paid enrolments from your payment system, held apart from free and granted access.

Get my free conversion tracking audit

Free30 minutesNo obligation

LearnDash → PostHog · when not to buy

When you don't need this — LearnDash → PostHog

  • Measure identifier coverage yourself first — pull your last hundred enrolments and count how many carry the distinct_id.
  • If every enrolment is a direct purchase, one conversion action is correct and simpler.
  • 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.

LearnDash → PostHog · what we deliver

What gets built — LearnDash → PostHog

  • Identifier capture into LearnDash

    Capture on landing and pass through the purchase flow to the enrolment record.

  • Event source: the payment record joined to the enrolment

    Send paid enrolments at the amount charged. Free and granted enrolments carry no value.

  • 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 and should revoke access.

Written guarantee

95%+ tracking accuracy

Measured against Paid enrolments from your payment system, held apart from free and granted access.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

LearnDash → PostHog questions, answered

Send an event from LearnDash's lesson completion hook server-side, with the WordPress user ID as distinct_id and the course and lesson IDs as properties.

Free · 30 min

Get LearnDash and PostHog joined properly

Free30 minutesNo obligation