Mixpanel Community Icon

Connecting User Events in Mixpanel: UUID vs. Authenticated IDs

·
·

So if a user not authenticated does an action in one system or domain and the same user does another action after being authenticated in Mixpanel, can Mixpanel connect the two events to the same user and how does it do this considering that one event is triggered server side and the other is triggered client side and they do not use the same unique identifier one uses UUID and other users the one defined by the dev

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    Hi event, Please stand by as I search the Mixpanel knowledge base for an AI-powered answer. I normally take about 15 seconds or so. In case AI cannot answer your question, feel free to reach out to Mixpanel support at mixpanel.com/get-support. If you have follow-up questions for this thread, please tag me again with your question: @kapa.ai <follow-up question> đź‘‹

    Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    Yes, Mixpanel can connect events from an unauthenticated user to the same user after they authenticate, even when events come from different sources (server-side vs. client-side) with different identifiers. This is accomplished through Mixpanel's ID Merge system.

    How Mixpanel Connects These Events

    Mixpanel uses a feature called ID Merge to stitch together user behavior across anonymous and authenticated states. Here's how it works: 1. For anonymous users: Mixpanel's client-side SDK automatically generates a $device_id (anonymous ID) that's attached to all events from that user on that device.2. Upon authentication: When the user logs in, you call .identify(<user_id> ) with their known identifier (like a database ID), which sets the $user_id property on subsequent events.3. ID Merging: When Mixpanel receives an event containing both $device_id and $user_id for the first time, it creates a mapping between these IDs, forming an "identity cluster." This allows Mixpanel to retroactively attribute all previous anonymous events to the now-identified user.

    Implementation Across Different Systems

    For your specific scenario with server-side and client-side tracking using different identifiers:

    Client-side Implementation

    mixpanel.identify("USER_ID");LBKS```

    Server-side Implementation

    { "event": "Server Side Event", "properties": { "token": "YOUR_PROJECT_TOKEN", "$device_id": "ANONYMOUS_UUID", "$user_id": "USER_ID" } }LBKS```LBKSLBKSThe key is ensuring that at some point, you send at least one event containing both the anonymous UUID (`$device_id`) and the authenticated user ID (`$user_id`). This triggers the ID merge that connects all events from both sources to the same user.LBKSThis approach works with Mixpanel's Simplified ID Merge system, which allows for retroactive merging of unlimited anonymous IDs to a user ID, ensuring that anonymous events across multiple platforms, devices, or sessions can always be merged to the respective user [Server-Side Stitching](https://docs.mixpanel.com/docs/session-replay#server-side-stitching).LBKSFor more detailed implementation guidance, you can refer to Mixpanel's documentation on [Identifying Users (Simplified)](https://docs.mixpanel.com/docs/tracking-methods/id-management/identifying-users-simplified) and [Server-Side Identity Management](https://docs.mixpanel.com/docs/tracking-methods/id-management/identifying-users-simplified#server-side-identity-management).

    kapa.ai is still learning and improving, please let me know how I did by reacting below.

    ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.

  • Avatar of event
    event
    ·
    ·

    How does Mixpanel merge the two together please kapa.ai is it the ip address? what does it use

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    Let me check the knowledge base for you again. One moment! 📚

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    Mixpanel doesn't use IP addresses to merge user identities. Instead, Mixpanel uses explicit ID properties in the event data to connect anonymous and authenticated user activities.

    How Mixpanel Merges User Identities

    Mixpanel uses a system called ID Merge that relies on two specific properties: 1. device_id**: Represents the anonymous/device identifier 2. **user_id: Represents the authenticated user identifierWhen Mixpanel receives an event containing both $device_id and $user_id properties for the first time, it automatically creates a mapping between these IDs, forming what's called an "identity cluster." This allows all events from both identifiers to be attributed to the same user.Here's how it works in practice: LBKS{ "event": "Sign Up", "properties": { "token": "YOUR_PROJECT_TOKEN", "$device_id": "anonymous111", "$user_id": "charlie" } }LBKSWhen this event is received, Mixpanel creates a mapping that connects "anonymous111" and "charlie" together. After this mapping is created, any past or future events with either identifier will be attributed to the same user profile.Mixpanel can retroactively merge an unlimited number of anonymous IDs ($device_id) to a user ($user_id), ensuring that anonymous events across multiple platforms, devices, or sessions can always be merged to the respective user Migrating to Simplified ID Merge.While Mixpanel does collect IP addresses for geolocation purposes, it doesn't use IP addresses for identity management or merging user identities.For more detailed information about implementing ID Merge, you can refer to Mixpanel's documentation on Identifying Users (Simplified).

    kapa.ai is still learning and improving, please let me know how I did by reacting below.

    ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.