Mixpanel Simplified ID Merge Explained: How Users Get Stitched Together

If your Mixpanel project says you have 40,000 users but your database says 25,000, you don’t have a traffic problem. You have an identity problem.

Identity is the part of Mixpanel that most implementations get slightly wrong, and “slightly wrong” is enough to inflate user counts, break signup funnels, and attribute one person’s purchases to a stranger who borrowed their laptop.

This post explains how Mixpanel’s Simplified ID Merge works under the hood, when to call identify() and reset(), and how to handle identity when you track from a server.

Step zero: check which ID Merge you’re on

Mixpanel has more than one identity system. Before you change anything, open your project settings and check the ID management section to see which Identity Merge API your project uses. Everything below applies to Simplified ID Merge. Original ID Merge projects follow different rules, and copying advice from one into the other is a common source of bugs.

The three IDs you need to understand

Simplified ID Merge revolves around three properties:

  • $device_id is the anonymous ID. The client SDKs generate it automatically and attach it to every event. Every client-side event should have one.
  • $user_id is your known identifier for a person, set when you call identify().
  • distinct_id is what Mixpanel uses to decide who is a unique user. In Simplified ID Merge, Mixpanel works this out for you from the other two.

The rule is simple. If an event has only a $device_id, that becomes the distinct ID. If it has a $user_id, that becomes the distinct ID. And the first time an event carries both, Mixpanel links them into an identity cluster. From then on, data sent under any ID in that cluster belongs to the same person.

How the merge plays out

Here’s the flow I walk clients through:

  1. A visitor lands on your site. The SDK gives them device ID D1. Their events are anonymous.
  2. They sign up. You call identify("U1") and track at least one more event. That event carries both D1 and U1, so Mixpanel links them.
  3. Mixpanel goes back and attributes the earlier anonymous events to U1 too. Your “landing page → signup” funnel now works.
  4. Next week, the same person visits on their phone (device D2). They browse anonymously, then log in. You call identify("U1") again, and D2 joins the same cluster. Mobile and desktop history are now one user.

One detail people miss: the merge needs an event after identify(). Calling identify and then sending nothing means the link never forms.

The shared device problem: reset()

Now imagine a family laptop. Person A logs in, then logs out. Person B logs in on the same browser. If you never reset, Person B’s anonymous browsing is still tagged with Person A’s device ID.

Calling reset() on logout clears the stored IDs and creates a fresh device ID. Mixpanel recommends doing this on logout and whenever a session drops out of the logged-in state, such as a timeout.

Server-side identity

Mixpanel’s server libraries don’t create IDs for you. If you track from a server, you manage identity yourself. Mixpanel’s guidance is to set $device_id and $user_id and let Mixpanel derive the distinct ID, rather than setting it directly.

The pattern:

  1. Generate an anonymous ID (a UUID works) and store it in a cookie so it persists across requests.
  2. Send it as $device_id on every anonymous event.
  3. After login, send both $device_id and $user_id on every event. That’s what triggers the merge.

If you do set distinct_id yourself, it should match the $user_id.

In hybrid setups, read the device ID the browser SDK already created and reuse it on the server. Generating a second anonymous ID server-side is the most common reason one visitor turns into two users.

Best practices I follow on every project

  • Use a stable database ID as $user_id, not an email. Simplified ID Merge can’t merge two user IDs or change one. If someone changes their email, they become a new user.
  • Call identify() on signup, login, and app reopen when already logged in. That last one is easy to forget.
  • Store the user ID as a super property and a profile property too. If the merge ever misbehaves, you have something to troubleshoot with.
  • Don’t create profiles for anonymous users. Profile properties set on a device-only ID aren’t carried over when it merges. Wait until after identify.
  • Document your identity design. A simple diagram of when you identify and reset will save hours on the next platform rollout.

Mistakes to avoid

  • Judging the merge in real time. A single user’s Activity Feed updates within a minute, but the mapping can take up to 24 hours to reach every report. A funnel checked an hour after launch may show false drop-offs.
  • Calling identify() with an email on one platform and a database ID on another. You get two people who can never be merged.
  • Skipping reset() on logout. Shared devices merge strangers.
  • Assuming old alias() code still behaves like the new system. If your project predates 2020 and uses alias, review it before you add anything new.

How to QA identity

Before you ship, walk through these journeys with a test account and check the user’s profile in Mixpanel:

  • Anonymous browsing → signup → events after signup: all on one profile?
  • Logged out on a second device → login: does the second device’s history join the same profile?
  • Log out → second test user logs in on the same browser: two separate profiles?
  • No duplicate profiles created during onboarding?

Final thoughts

Get identity right and almost everything else in Mixpanel becomes easier to trust. Get it wrong and every report carries a quiet error you’ll spend months explaining.

If your user counts don’t match your database, start here.

Sources

GET EXPERT ANALYTICS HELP

Need help getting reliable answers from Mixpanel?

Tell us about your tracking, funnels, retention, or reporting challenge. Optizent can help you implement, audit, and use Mixpanel with confidence.

We will use these details to respond to your request. Please do not include passwords, account access, or customer data.