Skip to main content
Supabase Auth → PostHogIntegration guide

Connecting Supabase Auth to PostHog

Supabase Auth sits directly on your own Postgres database, which means the identity and the revenue can be joined with a query rather than through an integration. 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 Supabase user 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 distinct_id as the Supabase user UUID, client and server

Use the Supabase auth UUID as PostHog's distinct_id everywhere, identifying in the browser and sending server events with it. Store PostHog's anonymous ID on the user row at signup request, so magic links opened on another device can be aliased server-side. Give trigger-fired events deterministic UUIDs, and consider querying billing through PostHog's Postgres source.

Use the Supabase auth user's UUID as the PostHog distinct_id everywhere. Call identify with it in the browser as soon as a session exists, and send server-side events, such as subscription started or plan upgraded, with the same UUID. That one decision makes the funnel from anonymous landing to paid account a single person in PostHog without any mapping table, because the ID you query in Postgres is the ID PostHog holds.

Two Supabase-specific gaps break the merge. A magic link opened on a different device creates a fresh anonymous person there, and the identify call on that device merges only that device's history, so the original landing visit stays orphaned unless you also stored PostHog's anonymous ID on the user row at signup request time and alias it server-side. And auth events fired from a database trigger can retry; give each one a deterministic event UUID derived from the user ID and event name so a retried batch does not count the signup twice.

Check whether PostHog's data warehouse can read your Supabase Postgres directly through its Postgres source. If so, billing tables can be queried alongside events without sending each payment as an event, which keeps revenue in one place and avoids a second copy drifting out of date.

Supabase Auth → PostHog · what breaks

Why this join usually fails — Supabase Auth → PostHog

  1. 01

    The distinct_id never reaches Supabase Auth

    OAuth flows redirect off-site and back, which can lose an identifier captured before login.

  2. 02

    Building a pipeline for a join you could write in SQL

    Teams reach for a CDP or an event pipeline to connect identity to revenue when both tables sit in the same database. The simplest correct answer is usually a scheduled query.

  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.

Supabase Auth → PostHog · the fix

What working looks like — Supabase Auth → PostHog

  • The distinct_id on every account

  • Conversions arriving in PostHog

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

  • Reconciled against the source

Supabase Auth → PostHog · architecture

How Supabase Auth and PostHog actually connect

  1. 1

    Supabase Auth holds the truth

    Because everything is in one Postgres instance, the join that most products build a pipeline for is a SQL statement here. That is a genuine advantage and it is frequently unused.

  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 Supabase user.

  4. 4

    The event source decides reliability

    Send paid conversions from a query joining auth users to billing.

  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.

Supabase Auth → PostHog · normal or broken

Working vs. broken, side by side — Supabase Auth → PostHog

Normal, not a fault

  • The distinct_id present on the account

  • Sent from your own database

  • 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

    OAuth flows redirect off-site and back, which can lose an identifier captured before login.

  • Sent from the browser

    Teams reach for a CDP or an event pipeline to connect identity to revenue when both tables sit in the same database. The simplest correct answer is usually a scheduled query.

  • 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

Supabase Auth → PostHog · diagnose

Diagnostic order — Supabase Auth → PostHog

  1. 01

    Count accounts carrying the distinct_id

  2. 02

    Follow one real conversion end to end

  3. 03

    Check whether identity and billing are in the same database

    If they are, most of the usual integration complexity is unnecessary.

  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.

Supabase Auth → PostHog · prove

How it gets proven — Supabase Auth → PostHog

Source of truth

Your own database, joining the auth user to the subscription or order table.

  • The distinct_id confirmed present on a live account.
  • Purchase events reconciled per transaction against your billing system, with ingestion lag checked over the same window.
  • Paid conversions reconciled by query against imported conversions, with identifier survival verified across OAuth.

Supabase Auth → PostHog · free audit

What we check in the free audit

  • Count accounts carrying the distinct_id
  • Follow one real conversion end to end
  • Check whether identity and billing are in the same database
  • Check ingestion health and disk before debugging any missing event
  • Read the match rate, not the success message

Checked against

Your own database, joining the auth user to the subscription or order table.

Get my free conversion tracking audit

Free30 minutesNo obligation

Supabase Auth → PostHog · when not to buy

When you don't need this — Supabase Auth → PostHog

  • Measure identifier coverage yourself first — pull your last hundred accounts and count how many carry the distinct_id.
  • If billing lives in a separate system, the join is a real integration again and the advantage disappears.
  • 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.

Supabase Auth → PostHog · what we deliver

What gets built — Supabase Auth → PostHog

  • Identifier capture into Supabase Auth

    Persist the identifier before the OAuth redirect and write it onto the user row at first login, where it is then permanently queryable.

  • Event source: your own database

    Send paid conversions from a query joining auth users to billing.

  • 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

    Cancellations reverse against the same user row.

Written guarantee

95%+ tracking accuracy

Measured against Your own database, joining the auth user to the subscription or order table.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Supabase Auth → PostHog questions, answered

The auth user's UUID, set with identify in the browser and reused for every server-side event, so frontend and backend events land on the same person.

Free · 30 min

Get Supabase Auth and PostHog joined properly

Free30 minutesNo obligation