Skip to main content
Firebase Auth → MixpanelIntegration guide

Connecting Firebase Authentication to Mixpanel

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. Mixpanel is a product analytics tool, not an ad platform, which means it has no attribution model of its own and will faithfully report whatever event schema you give it — including a bad one. The join between them succeeds or fails on one thing: whether the distinct_id reaches the Firebase user identity before the conversion happens, because Mixpanel can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

Firebase Auth to Mixpanel: identify() with the uid, at the right time

Call Mixpanel's identify() with the Firebase uid at sign-in and reset() at sign-out, on web and app. Avoid identifying anonymous users unless every one is upgraded with linkWithCredential. Send server events from Cloud Functions or billing with distinct_id as the uid and $insert_id as the transaction ID, and test that shared-device sign-ins stay separate.

Call Mixpanel's identify() with the Firebase uid when the user signs in, and reset() when they sign out, on web and in the app. Under Mixpanel's current ID merge, identify links the device's prior history to that uid, so the web visit before signup and the in-app session after it land on one profile.

The trap is calling identify() on an anonymous Firebase user. If that anonymous uid is later replaced rather than linked, Mixpanel has merged the device's history into an ID that will never pay, and the real account starts empty. Either wait to identify until the account has a real credential, or make sure every anonymous account is upgraded with linkWithCredential so the uid never changes.

Server events from Cloud Functions or billing go in with distinct_id set to the uid and $insert_id set to the transaction or event ID. The forgotten reset() is the other common break here: on a shared device, the next person to sign in inherits the previous user's device history until it is called. Test sign-out followed by sign-in as a different account and confirm both profiles stay separate.

Firebase Auth → Mixpanel · what breaks

Why this join usually fails — Firebase Auth → Mixpanel

  1. 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.

  2. 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.

  3. 03

    One event schema, two teams, no agreement

    Marketing names an event Purchase, the product team names it purchase_completed, and both are sent. Mixpanel treats them as unrelated, every funnel silently splits, and two teams spend a quarter arguing about which number is right when both are.

  4. 04

    Nothing reconciles afterwards

    Mixpanel shows events in the live view within moments. Check that the distinct_id matches the signed-in user rather than a lingering anonymous ID, because that is the failure that quietly breaks every cross-signup funnel.

Firebase Auth → Mixpanel · the fix

What working looks like — Firebase Auth → Mixpanel

  • The distinct_id on every account

  • Conversions arriving in Mixpanel

    The event lands on the user profile and becomes available in funnels, retention and cohort analysis.

  • Reconciled against the source

    Firebase Authentication's own records are the reference, not either dashboard.

Firebase Auth → Mixpanel · architecture

How Firebase Auth and Mixpanel actually connect

  1. 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. 2

    Mixpanel needs a click to match

    Mixpanel needs a distinct_id, an event name and its properties. Events without a distinct_id are rejected; events with the wrong one land on a stranger's profile.

  3. 3

    The identifier is the bridge

    The distinct_id, captured at the visit and carried into the Firebase user identity.

  4. 4

    The event source decides reliability

    Send paid conversions keyed on the user identity. Signups and anonymous sessions are stages, not revenue.

  5. 5

    Deduplication at the destination

    Mixpanel deduplicates on $insert_id within a time window. Without it, a retried server request creates a second event, and because Mixpanel is where product decisions get made, that inflation ends up in a roadmap rather than in an ad report.

Firebase Auth → Mixpanel · normal or broken

Working vs. broken, side by side — Firebase Auth → Mixpanel

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

    Mixpanel deduplicates on $insert_id within a time window. Without it, a retried server request creates a second event, and because Mixpanel is where product decisions get made, that inflation ends up in a roadmap rather than in an ad report.

  • Reconciles with the source

    Mixpanel'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

    Marketing names an event Purchase, the product team names it purchase_completed, and both are sent. Mixpanel treats them as unrelated, every funnel silently splits, and two teams spend a quarter arguing about which number is right when both are.

  • Nobody has reconciled it

    The dashboard shows a number and no one has compared it to Firebase Authentication.

Firebase Auth → Mixpanel · diagnose

Diagnostic order — Firebase Auth → Mixpanel

  1. 01

    Count accounts carrying the distinct_id

  2. 02

    Follow one real conversion end to end

  3. 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.

  4. 04

    List every event name in the project and look for near-duplicates

    Case differences, tense differences and synonyms are the usual finding, and they are cheap to fix before a year of data is built on them.

  5. 05

    Read the match rate, not the success message

    Mixpanel shows events in the live view within moments. Check that the distinct_id matches the signed-in user rather than a lingering anonymous ID, because that is the failure that quietly breaks every cross-signup funnel.

Firebase Auth → Mixpanel · prove

How it gets proven — Firebase Auth → Mixpanel

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 identity aliasing verified across the signup boundary.
  • Paid conversions reconciled per linked user identity against imported conversions.

Firebase Auth → Mixpanel · 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
  • List every event name in the project and look for near-duplicates
  • Read the match rate, not the success message

Checked against

Your billing system, keyed on the Firebase user ID.

Get my free conversion tracking audit

Free30 minutesNo obligation

Firebase Auth → Mixpanel · when not to buy

When you don't need this — Firebase Auth → Mixpanel

  • If Mixpanel 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 already have the same events in a warehouse and nobody is running product analysis on them, adding Mixpanel adds a second source of truth rather than an answer.

Firebase Auth → Mixpanel · what we deliver

What gets built — Firebase Auth → Mixpanel

  • 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 Mixpanel

    The Mixpanel ingestion API, posted server-side from your backend with the distinct_id and event properties.

  • 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.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Firebase Auth → Mixpanel questions, answered

When onAuthStateChanged reports a user with a real credential, using the uid. Call reset() on sign-out so the next user on that device starts clean.

Free · 30 min

Get Firebase Auth and Mixpanel joined properly

Free30 minutesNo obligation