Mastering Product Analytics with Mixpanel & GA4Lesson 12 of 32
Lesson 12 of 32

User Profile Properties & Identity Resolution (Distinct ID & User Aliasing)

Overview & Learning Objectives

How does Mixpanel know that the anonymous visitor who browsed 5 shoes on their laptop on Tuesday is the exact same human who logged into their account on an Android phone on Thursday and bought the shoes? The secret is Identity Resolution. In this lesson, you will master Mixpanel's Distinct ID system, the `identify()` method, the `alias()` method, and how to prevent split user identities.

  • Understand how Mixpanel assigns anonymous UUIDs (`$device_id`) before login.
  • Implement `mixpanel.identify(user_id)` and `mixpanel.alias(user_id)` on signup.
  • Prevent duplicate profile creation and identity stitching bugs during multi-device sessions.
Example

Real-World Example: The Masked Detective Who Unmasks at the Castle Door

PRACTICAL CONTEXT
  • Scenario: A masked carnival guest browsing booths anonymously before removing the mask at the VIP entrance.
  • Distinct ID: An anonymous cookie ID tracks pre-login activity until user authentication occurs.
  • Identity Merge: Mixpanel/GA4 stitches anonymous history to the verified User ID so historical attribution remains unbroken.
Corporate / Tech Term Everyday / Practical Metaphor Operational Meaning
Anonymous ID (`$device_id`) The Purple Masquerade Mask ("Guest #749") Random computer number assigned before user logs in.
Authenticated ID (`user_id`) Your Real Name ("Bruce Wayne") The permanent database account ID after signup/login.
`identify()` Method Unmasking at the VIP door Telling Mixpanel: "Connect this device to my real account!"
Split Identity Bug Creating two separate photo albums for the same person When an engineer forgets to call identify, creating fragmented data.
Core Principle: Always call `mixpanel.identify()` immediately upon successful login, and call `mixpanel.reset()` on logout so public computers don't mix up accounts!

Visual Infographic: How Mixpanel Identity Stitching Works

IDENTITY INFOGRAPHIC
Stage 1
1. Anonymous Browsing

User lands on website -> Given anonymous `$device_id: "anon_99182"`.

Stage 2
2. User Signs Up

User enters email and creates account with database `user_id: "usr_4021"`.

Stage 3
3. Call mixpanel.identify()

Mixpanel stitches all past anonymous clicks to `usr_4021`.

Stage 4
4. Log In on Mobile Phone

Calling `identify("usr_4021")` on mobile links phone to the same profile!

Industry Standard & Framework

Standard: Mixpanel Simplified Identity API & Distributed Graph Resolution Standards.

Real-World Business Application: Zerodha Kite Cross-Platform Identity Resolution

Zerodha tracks investor stock research across anonymous desktop landing pages and authenticated mobile trading apps.

User Lifecycle StageMixpanel Method CalledDistinct ID ValueData Stored
Anonymous Landing Page VisitSDK Auto-Generated`"$device:d8a9f-3312"`Ad campaign source, referral link, 3 stocks viewed
Account Registration Complete`mixpanel.alias("ZER_9921")`Linked to `"$device:d8a9f-3312"`Permanent alias bridge established
Subsequent Login on iPhone`mixpanel.identify("ZER_9921")``"ZER_9921"`Past web history now merged with iPhone app sessions
User Logs Out`mixpanel.reset()`New anonymous `$device_id`Prevents next user on shared laptop from sharing cookies

Step-by-Step UI Tutorial & Visual Workflow Guide

Below is the practical, non-technical walkthrough showing how Product Analysts design, review, and execute this capability inside real-world tools like Mixpanel, Google Analytics 4, BigQuery, and Google Tag Manager.

Step-by-Step Execution Workflow

EXECUTION PHASES
1 Mixpanel SDK
Anonymous Session Ingestion

Automatically generates a unique device GUID stored in browser localStorage or iOS Keychain.

2 Frontend Engineer
Signup Hook Instrumentation

On successful user registration response, trigger `mixpanel.alias(user_id)`.

3 Frontend Engineer
Login Hook Instrumentation

On user login, trigger `mixpanel.identify(user_id)` and populate User Profile properties (`$email`, `plan`).

4 Frontend Engineer
Logout Reset Call

On logout button tap, call `mixpanel.reset()` to generate a clean anonymous ID.

5 Product Analyst
Identity Audit in Users Tab

Search for test user ID in Mixpanel "Users" tab to verify anonymous and authenticated events appear on one unified timeline.

Mixpanel Users Profile Explorer

Step-by-Step UI Tutorial: Inspecting User Profiles & Event Streams in Mixpanel

Step 1
Step 1: Open Users Tab

In Mixpanel left sidebar, click "Users" -> "Explore".

Step 2
Step 2: Search by User ID or Email

Type a user's distinct ID or email address in the search filter.

Step 3
Step 3: Inspect User Properties Drawer

Look at the left panel to see lifetime spend, country, signup date, and total sessions.

Step 4
Step 4: Review Chronological Activity Feed

Scroll through the center timeline to see every single event the user performed from Day 1 to today.

Identity Resolution Methods Cheat Sheet

SDK METHODS
methodwhen To Callaction Taken
`mixpanel.identify(id)`On every successful login or session restoreSets current Distinct ID to the authenticated user ID
`mixpanel.alias(new_id)`Once only, immediately after account signupPermanently links pre-signup anonymous history to new user ID
`mixpanel.reset()`Immediately when user taps "Log Out"Clears user cookies and creates a brand-new anonymous ID
`mixpanel.people.set({})`Whenever user profile info updatesSaves permanent traits: name, subscription, phone

Implementation Guidelines for Product Analysts

  • Never call `mixpanel.alias()` multiple times for the same user, as this can corrupt identity graphs in legacy implementations.
  • Always call `mixpanel.reset()` on logout to ensure shared office or family computers don't pollute user profiles.
  • Never use email addresses as your primary Distinct ID because users may change their email address later.

Practical Hands-On Exercises

  1. What happens if an engineer forgets to call `mixpanel.reset()` when User A logs out and User B logs in on the same tablet?
  2. Explain the difference between `$device_id` and `user_id` in Mixpanel.