Connecting Firebase Authentication to PostHog
Firebase Auth is usually the identity layer in a mobile-first product, which means the user ID it issues is the only thing connecting a web visit to an in-app purchase. 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 Firebase user identity 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
Firebase Auth to PostHog: distinct_id equals the Firebase uid
Call PostHog identify with the Firebase uid when onAuthStateChanged reports a real user, on web and app, and send billing events with the same uid as distinct_id and an explicit UUID. If anonymous accounts are linked, identifying early is safe; if signup creates a fresh account, leave anonymous users unidentified or alias the old uid.
PostHog and Firebase line up naturally: call identify with the uid when onAuthStateChanged reports a real user, on the web and in the app, and send server-side events from billing with the same uid as distinct_id. That one decision gives you a person profile spanning the marketing site, the app and the payment, which is the funnel most Firebase products cannot see anywhere else.
The anonymous question needs a deliberate answer. If you use Firebase anonymous auth and link at signup, the uid never changes, so identifying with it from the first session is safe. If signup creates a fresh account, the anonymous uid and the real uid are two people, and PostHog will not merge two already-identified users through identify alone. Either leave anonymous Firebase users unidentified, or alias the old uid to the new one at signup; check PostHog's current merge rules before choosing.
Server-side, send the paid event with an explicit UUID so a retried billing webhook does not count twice, and include the uid on renewals so they attach to the same person. If you self-host, you own the ingestion endpoint your app posts to, so monitor it.
Firebase Auth → PostHog · what breaks
Why this join usually fails — Firebase Auth → PostHog
- 01
The distinct_id never reaches Firebase Auth
Anonymous authentication creates users before signup, and linking an anonymous account to a real one is a step teams frequently skip.
- 02
Anonymous accounts never linked to real ones
Firebase's anonymous auth is convenient and creates a separate user. If it is not linked at signup, the pre-signup activity and the paying customer are two different people in every downstream system.
- 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.
- 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.
Firebase Auth → PostHog · the fix
What working looks like — Firebase 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
Firebase Authentication's own records are the reference, not either dashboard.
Firebase Auth → PostHog · architecture
How Firebase Auth and PostHog actually connect
- 1
Firebase Authentication holds the truth
Firebase holds identity, not revenue. Its value to measurement is that it gives a stable key that survives the web-to-app transition where every cookie dies.
- 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
The identifier is the bridge
The distinct_id, captured at the visit and carried into the Firebase user identity.
- 4
The event source decides reliability
Send paid conversions keyed on the user identity. Signups and anonymous sessions are stages, not revenue.
- 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.
Firebase Auth → PostHog · normal or broken
Working vs. broken, side by side — Firebase Auth → PostHog
Normal, not a fault
The distinct_id present on the account
Visible on the record itself in Firebase Authentication, not merely captured somewhere on the site.
Sent from your billing system, keyed on the user ID
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
PostHog's count and Firebase Authentication's records agree within a few percent over a closed window.
Actually broken
The distinct_id missing on most records
Anonymous authentication creates users before signup, and linking an anonymous account to a real one is a step teams frequently skip.
Sent from the browser
Firebase's anonymous auth is convenient and creates a separate user. If it is not linked at signup, the pre-signup activity and the paying customer are two different people in every downstream system.
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
The dashboard shows a number and no one has compared it to Firebase Authentication.
Firebase Auth → PostHog · diagnose
Diagnostic order — Firebase Auth → PostHog
- 01
Count accounts carrying the distinct_id
- 02
Follow one real conversion end to end
- 03
Check whether anonymous accounts are linked or orphaned at signup
Orphaned anonymous users are the most common Firebase identity failure and they silently break every cross-signup funnel.
- 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.
- 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.
Firebase Auth → PostHog · prove
How it gets proven — Firebase Auth → PostHog
Against Firebase Authentication's own records, not against either platform's dashboard.
Source of truth
Your billing system, keyed on the Firebase user ID.
- 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 per linked user identity against imported conversions.
Firebase 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 anonymous accounts are linked or orphaned at signup
- Check ingestion health and disk before debugging any missing event
- Read the match rate, not the success message
Checked against
Your billing system, keyed on the Firebase user ID.
Free30 minutesNo obligation
Firebase Auth → PostHog · when not to buy
When you don't need this — Firebase Auth → PostHog
- If PostHog already reports conversions that reconcile against Firebase Authentication's records within a few percent, this join is working and there is nothing to buy.
- Measure identifier coverage yourself first — pull your last hundred accounts and count how many carry the distinct_id.
- If you do not use anonymous auth, the linking problem 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.
Firebase Auth → PostHog · what we deliver
What gets built — Firebase Auth → PostHog
Identifier capture into Firebase Auth
Capture the identifier on the web, write it to custom claims or your own user document at first auth, and link anonymous accounts rather than creating duplicates.
Event source: your billing system, keyed on the user ID
Send paid conversions keyed on the user identity. Signups and anonymous sessions are stages, 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
Cancellations reverse against the same identity.
Written guarantee
95%+ tracking accuracy
Measured against Your billing system, keyed on the Firebase user ID.. Miss it and we keep working at no cost.
From $400 · See packages
FAQ
Firebase Auth → PostHog questions, answered
Only if you link anonymous accounts at signup, so the uid stays the same. Otherwise keep them anonymous and identify once a real credential exists.
Yes, from an auth trigger or your signup endpoint, with the uid as distinct_id. Filter out anonymous users there, or every visitor shows up as a new signup.
Almost always because the distinct_id never reached the Firebase user identity. Anonymous authentication creates users before signup, and linking an anonymous account to a real one is a step teams frequently skip. Measure coverage before debugging the dispatch.
PostHog identifies by distinct_id with an alias call to merge anonymous and identified users. On a self-hosted instance you also control the ingestion endpoint, which means the identifier survives ad blockers that would kill a third-party pixel — one of the few genuine technical advantages available to a first-party setup.
Your billing system, keyed on the user ID. Send paid conversions keyed on the user identity. Signups and anonymous sessions are stages, not revenue.
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.
More on Firebase Auth → PostHog
- Firebase Auth → Google AdsConnecting Firebase Authentication to Google Ads
- Firebase Auth → MetaConnecting Firebase Authentication to Meta Conversions API
- Firebase Auth → GA4Connecting Firebase Authentication to GA4
RELATED GUIDES
Where Firebase Auth → PostHog fits in the rest of your tracking
- Auth0 → PostHogConnecting Auth0 to PostHog
- Okta → PostHogConnecting Okta to PostHog
- Supabase Auth → PostHogConnecting Supabase Auth to PostHog
- Firebase Auth → MatomoConnecting Firebase Authentication to Matomo
- Firebase Auth → AmplitudeConnecting Firebase Authentication to Amplitude
- SaaSConversion tracking for SaaS, from signup through to the payment that matters
- Clerk → PostHogConnecting Clerk to PostHog
Free · 30 min
Get Firebase Auth and PostHog joined properly
Free30 minutesNo obligation
