Do I need to include the anonymous device id in the properties of different events in order for Mixpanel to understand that the events are from the same user?
Hi Nic, 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
Yes, you need to include the anonymous device ID (as the property $device_id) in the properties of events for Mixpanel to understand that those events are from the same anonymous user—especially before the user is identified (e.g., before login or signup).When a user is anonymous, all events should include a $device_id property. Mixpanel uses this value to associate all events from the same device/session with the same anonymous user. If you later identify the user (e.g., after login) and send an event with both $device_id and $user_id, Mixpanel will merge the anonymous and identified activity into a single user profile. This process is automatic in the Simplified ID Merge API and does not require you to set the distinct_id directly; Mixpanel will handle it based on the presence of $device_id and $user_id in the event properties. If only $device_id is present, Mixpanel uses it as the distinct_id for that event, ensuring all events with the same $device_id are linked to the same anonymous user until identification occurs Understanding Simplified ID Merge Identifying Users (Simplified).Summary:
- For anonymous users, always include $device_id in event properties.
- This allows Mixpanel to group events from the same device/session as one user.
- After identification, include both $device_id and $user_id once to merge the histories.This is essential for accurate user tracking and identity merging in Mixpanel.
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.
Let me check the knowledge base for you again. One moment! 📚
If you are using Mixpanel’s client-side SDKs (such as for web or mobile), Mixpanel does automatically generate and include a $device_id for anonymous users. This $device_id is attached to all events tracked by that user on that device until you call identify() or reset(). You do not need to manually include the $device_id in your event properties when using the client-side SDKs—Mixpanel handles this for you Identifying Users (Simplified).However, if you are sending events from your server (using server-side SDKs or the HTTP API), Mixpanel does not generate a $device_id for you. In this case, you are responsible for generating and including a unique anonymous ID (as $device_id) in your event properties to ensure that Mixpanel can associate events from the same anonymous user Server-side Identity Management.Summary:
- Client-side SDKs: Mixpanel automatically generates and includes $device_id for anonymous users.
- Server-side tracking: You must generate and include $device_id yourself.If you are only using client-side SDKs, you do not need to take any extra steps for anonymous user tracking. If you are sending events from your server, you must handle $device_id yourself.
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.
