Skip to main content
Moodle → PostHogIntegration guide

Connecting Moodle to PostHog

Moodle is self-hosted open-source learning management, used mostly by institutions where enrolment and payment are usually two different systems. 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 Moodle 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 on Moodle: identify learners, mask quizzes in replay

Add the PostHog snippet through Moodle's additional HTML or theme, identify with the Moodle user ID on login, and send paid enrollments server-side with enrollment method as a property. Mask all inputs in session replay and exclude quiz, grade and messaging pages. Alias the marketing anonymous ID on first login across SSO.

PostHog suits a Moodle site that sells courses and wants product analytics on the learning experience itself: which free lesson leads to a paid enrollment, where learners stall in the first week, which courses are abandoned. Add the snippet through Moodle's additional HTML setting or the theme, call identify with the Moodle user ID on login, and send paid enrollments server-side from the enrollment event with the same distinct_id and the enrollment method as a property, so funnels can split free from paid.

The Moodle-specific risk is session replay. Quiz attempts, assignment submissions, gradebook pages and forum posts are student records, and an unmasked replay copies them into your analytics store. Mask all inputs and text by default and exclude quiz, grade and messaging pages from recording entirely. If the site serves minors or a US institution's enrolled students, check with whoever owns FERPA compliance before turning replay on at all.

A second break: when learners sign in through institutional SSO, the anonymous visitor on your marketing site and the identified user in Moodle may never be linked, because the login happens on a third domain. Pass the PostHog anonymous ID to Moodle in the link from the course page and alias it on first login, or accept that pre-signup marketing touches will not join to enrollments.

Moodle → PostHog · what breaks

Why this join usually fails — Moodle → PostHog

  1. 01

    The distinct_id never reaches Moodle

    Moodle is typically behind a login and often behind a separate marketing site, so the click identifier has to survive from a public page through registration into a user profile field. Institutional single sign-on frequently breaks that chain entirely.

  2. 02

    Free enrolments outnumbering paid ones

    Self-enrolment, cohort sync and manual enrolment all create the same record type as a paid one. Counting them teaches bidding to find people who join free courses.

  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.

Moodle → PostHog · the fix

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

Moodle → PostHog · architecture

How Moodle and PostHog actually connect

  1. 1

    Moodle holds the truth

    Moodle supports several enrolment methods at once — self-enrolment, manual, cohort sync, payment plugins — and most of them are free. Only the paid methods represent revenue and the others will swamp any blended count.

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

  4. 4

    The event source decides reliability

    Send paid enrolments only, from the server. Free and cohort-synced enrolments must be excluded or the conversion feed is dominated by activity that is not revenue.

  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.

Moodle → PostHog · normal or broken

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

Normal, not a fault

  • The distinct_id present on the enrolment

  • Sent from the Moodle enrolment event via a webhook plugin or scheduled export

  • 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

    Moodle is typically behind a login and often behind a separate marketing site, so the click identifier has to survive from a public page through registration into a user profile field. Institutional single sign-on frequently breaks that chain entirely.

  • Sent from the browser

    Self-enrolment, cohort sync and manual enrolment all create the same record type as a paid one. Counting them teaches bidding to find people who join free courses.

  • 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

Moodle → PostHog · diagnose

Diagnostic order — Moodle → PostHog

  1. 01

    Count enrolments carrying the distinct_id

  2. 02

    Follow one real conversion end to end

  3. 03

    Break down enrolments by enrolment method

    If paid methods are a small minority, that minority is the only thing that should ever reach an ad platform.

  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.

Moodle → PostHog · prove

How it gets proven — Moodle → PostHog

Source of truth

Moodle's enrolment records in your own database, filtered to paid enrolment methods.

  • 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 confirmed separated from free and cohort-synced ones before anything is sent.

Moodle → PostHog · free audit

What we check in the free audit

  • Count enrolments carrying the distinct_id
  • Follow one real conversion end to end
  • Break down enrolments by enrolment method
  • Check ingestion health and disk before debugging any missing event
  • Read the match rate, not the success message

Checked against

Moodle's enrolment records in your own database, filtered to paid enrolment methods.

Get my free conversion tracking audit

Free30 minutesNo obligation

Moodle → PostHog · when not to buy

When you don't need this — Moodle → PostHog

  • Measure identifier coverage yourself first — pull your last hundred enrolments and count how many carry the distinct_id.
  • If your Moodle is purely internal training with no paid enrolment, there is no conversion here to measure.
  • 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.

Moodle → PostHog · what we deliver

What gets built — Moodle → PostHog

  • Identifier capture into Moodle

    Capture the identifier on the public site and write it to a Moodle user profile custom field at account creation, so later paid enrolments can be traced back.

  • Event source: the Moodle enrolment event via a webhook plugin or scheduled export

    Send paid enrolments only, from the server. Free and cohort-synced enrolments must be excluded or the conversion feed is dominated by activity that is not revenue.

  • 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

    Un-enrolments and refunds where a payment plugin is used should reduce the reported figure.

Written guarantee

95%+ tracking accuracy

Measured against Moodle's enrolment records in your own database, filtered to paid enrolment methods.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Moodle → PostHog questions, answered

Call identify with the Moodle user ID after login and send server-side enrollment events with that same ID as the distinct_id. Avoid email as the ID, since learners change it and SSO accounts often carry institutional addresses.

Free · 30 min

Get Moodle and PostHog joined properly

Free30 minutesNo obligation