How is it that the User ID isn't set in some events, even though I can see it in the 'View Users – Activity Feed'? It's incorrectly grouping some users under the cohort that only uses Device ID, even though those users actually have a User ID and when I breakdown by User ID it says not set and have triggered the event that should exclude them from that group.
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
This situation can occur due to the way Mixpanel handles identity merging and event attribution, especially when using the Simplified ID Merge system.
Key Points:
1. Event Properties and Identity Merge Timing:
When a user is anonymous, events are tracked with only a $device_id. After the user logs in and you call .identify(<user_id> ), subsequent events should include both $device_id and $user_id. However, events sent before .identify() will not have $user_id set, and those events remain attributed only to the device until the merge occurs. Mixpanel retroactively updates the Activity Feed to show the merged user, but the original events themselves may still lack the $user_id property in their raw data, which can affect cohort definitions and breakdowns that rely on the presence of $user_id as an event property Identifying Users (Simplified) – Example User Flows.
2. Cohort and Breakdown Behavior:
When you create a cohort or breakdown by $user_id, Mixpanel looks at the event property on each event. If the event was tracked before the user was identified (i.e., before .identify() was called), it will not have $user_id set, even if the Activity Feed now shows the merged user. This is why you may see users grouped under "Device ID only" cohorts, even though they have since been identified and merged in the UI Identifying Users (Simplified) – FAQ.
3. Retroactive Merging and Reporting Delay: Mixpanel’s retroactive identity merging updates the Activity Feed in real time, but it can take up to 24 hours for this mapping to propagate to all other parts of the system, including reports and cohorts. During this window, you may see inconsistencies between the Activity Feed and cohort/breakdown results Identifying Users (Simplified) – FAQ.
4. Best Practice:
To ensure accurate cohorting and breakdowns, always call .identify(<user_id> ) as soon as the user is authenticated, and send at least one event after identification. This ensures that future events have $user_id set. However, events tracked before identification will not have $user_id and will be grouped by $device_id in breakdowns and cohorts that depend on the event property Client-side Identity Management.
Summary:
The discrepancy arises because the Activity Feed shows the merged user (reflecting the identity cluster), but event-level properties used for cohorting and breakdowns are not retroactively updated to include $user_id on events tracked before identification. This is expected behavior in Mixpanel’s identity system.
If you need to exclude users from a cohort based on an event that should have a $user_id, ensure that the event is always sent after identification, or adjust your cohort logic to account for this identity merging behavior.
For more details, see: - Identifying Users (Simplified) – Example User Flows - Identifying Users (Simplified) – FAQ
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.
