Hi! I have some challenges in setting up identities in Mixpanel. I'm using Segment for administrating the events and our project uses the classic identity resolution. I have the following identifiers:
account_id - Represents a unique user identity across the platform, independent of organization membership. An account can have multiple users (one per organization they join).
organization_user_id represents a membership of one account in one organization.
We use backend events but due to our system architecture, the preferable 1:1 account_id identifier is not always available to be sent. What is available instead is a organization_user_id . In the Segment action integration I can setup the following fields for a track call:
Distinct ID
Anonymous ID
User ID
for an identify call I can send the following:
User ID
Anonymous ID
There is also alias action available (but the doc recommend to use "merge" which is not available in Segment actions) with the following inputs:
Alias
Distinct ID
How can I use the segment integration with my data, and reliably identify unique user's activity?
Hi Noga K., 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
You can make this work with Segment + Mixpanel, but you need to pick one stable identifier to be the Mixpanel distinct_id, and then be deliberate about how you map account_id vs organization_user_id into Segment’s userId / anonymousId fields.From the docs, key points: - Segment’s identify userId is mapped to Mixpanel distinct_id and used to identify the user. [Segment integration]
- In Actions, “Identify Calls” trigger Identify User (Mixpanel ID merge) + Set Profile Properties. [Data mapping]
- In a Segment → Mixpanel setup, you should treat the Segment userId as “the” user identifier in Mixpanel. [Segment integration]
- Best‑practice for ID choice: use a stable database‑style ID that never changes; don’t use something that might later need to be merged or changed. [Simplified FAQ]Given your model: - account_id = true cross‑org person ID (what Mixpanel should treat as one user)
- organization_user_id = membership (you likely don’t want each membership to be a new Mixpanel user)
1. Decide what distinct_id should be
Because you said “unique user identity across the platform” is account_id, Mixpanel’s distinct_id should be account_id if your goal is per‑person analytics (one profile per human). [Identity overview]So the goal is: - In Segment identify calls:
- userId = account_id
- In Segment track calls:
- userId = account_id (if available)
- If only organization_user_id is available, you should not treat that as a separate permanent Mixpanel user if you can avoid it.The problem is that sometimes account_id is not available on the backend.
2. Handle cases when account_id is missing
From Mixpanel’s identity docs, the recommended pattern when a stable user ID isn’t available yet is: - Use an anonymous ID and later merge it to the real user ID once known. [Server-side identity; Identity FAQ]For Segment → Mixpanel: 1. When backend doesn’t know account_id, but does know organization_user_id:
- Treat organization_user_id as an anonymous/device‑like ID, not the durable user ID.
- In Segment, send:
- anonymousId = organization_user_id
- userId empty.
- Segment will then pass this to Mixpanel as events with an anonymous identifier (mapped to distinct_id / $device_id based on your Actions config).2. When frontend or another service does know account_id:
- Send Segment identify:
- userId = account_id
- Optional: include organization_user_id as a trait (e.g. current_organization_user_id) so you can still analyze by membership, but you’re not making it a user ID.
- Segment’s Mixpanel Actions destination will perform Mixpanel’s “Identify User” action, linking the prior anonymous activity (from the same anonymousId) to the identified user. [Data mapping; Identity FAQ]This mirrors the standard anonymous → identified merge flow Mixpanel recommends. [Identifying users – original; Simplified client identity]
3. Avoid using organization_user_id as distinct_id if you need cross‑org stitching
If you were to: - Map organization_user_id to Segment userId (which becomes Mixpanel distinct_id), then
- A single real person with 3 orgs would become 3 Mixpanel users.That’s consistent with the docs (Mixpanel treats different distinct_id values as different users) [Identity overview], and there’s no documented mechanism (in the Segment Actions integration) to bulk send Mixpanel $merge events to combine those clusters afterward. The docs even note that for Original ID Merge the $merge event is only available via the import API, not SDK methods. [Original mechanism]Because of that, if you care about “one person across orgs,” you should: - Do not systematically map organization_user_id to Mixpanel distinct_id.
- Only use it as:
- anonymousId in Segment, and/or
- A normal property/trait (organization_user_id) on events and profiles.
4. About Segment “alias” Action
The docs say: - $create_alias is a legacy function and not recommended for projects using ID Merge. [Original mechanism – $create_alias]
- For merging identified IDs, Mixpanel now recommends $merge via the import API. [Original FAQ]Your Segment Actions destination only exposes Alias (create_alias), not $merge. Given Mixpanel’s own recommendation toward $merge and away from alias, and that Segment doesn’t expose $merge in Actions, the safest path (per docs) is: - Avoid using the Alias action for new implementations.
- Instead, design things so each real user has only one userId (account_id), and rely on anonymousId + identify rather than alias/merge between two identified IDs.
5. Concrete mapping pattern
Based strictly on the docs: **When you know account_id:- Segment identify:
- userId = account_id
- traits include organization_user_id if relevant.
- Segment track:
- userId = account_id
- anonymousId can be left as whatever Segment is using client‑side; Mixpanel will link it through the Identify action. [Segment integration; Data mapping]When only organization_user_id is known (no account_id):**- Segment track:
- anonymousId = organization_user_id (or a deterministic hash of it)
- userId empty
- Later, once account_id becomes known for that same logical user:
- Send identify with userId = account_id using Segment from a context that has the same anonymousId (e.g. browser, or tie it via Segment’s own identity resolution).
- Mixpanel will then merge anonymous activity to the identified profile once Identify is processed. [Identity FAQ]This lets you: - Keep Mixpanel user profiles at the account level, not per‑membership.
- Still analyze by organization and organization_user_id via event/user properties.
- Avoid relying on $merge and $create_alias, which Segment Actions doesn’t expose in the recommended way.---If you need more granular guidance (e.g., exactly how to wire Segment’s identity resolution so that the same anonymousId is preserved between backend and frontend), the docs provided don’t go into that Segment‑internal behavior, so I can’t speak beyond what’s above.
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.
