I have 2 different distinct IDs that belong to the same user. How can I merge the events data under one user?
Hi Ilya L., 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
To merge two different distinct IDs that belong to the same user in Mixpanel, the method depends on which ID management system your project uses: ---
If You Use the Original ID Merge API
You can merge two distinct IDs (identity clusters) by sending a special $merge
event via the /import API. This allows you to combine the events and profiles associated with both IDs into a single user. Here’s an example payload: LBKS{ "event": "$merge", "properties": { "$distinct_ids": [ "distinct_id_1", "distinct_id_2" ], "token": "YOUR_PROJECT_TOKEN" } }LBKS
This event must be sent via the /import API, and you can find more details in the Mixpanel API reference. Note that the Original ID Merge API allows merging up to 500 IDs in a single identity cluster Docs: Identifying Users (Original) - FAQ.---
If You Use the Simplified ID Merge API
With Simplified ID Merge, you cannot merge two $user_id
s (i.e., two identified users). However, you can merge multiple $device_id
s (anonymous IDs) into a single $user_id
by sending an event that includes both the $device_id
and the $user_id
properties. This will automatically merge the anonymous and identified activity under one user. But if you have two separate $user_id
s, they cannot be merged under this system Docs: Identifying Users (Simplified) - FAQ.---**Summary Table:**| ID Management System | Can Merge Two Distinct IDs? | How to Merge? |
|--------------------------|-----------------------------|-------------------------------------------------------------------------------|
| Original ID Merge | Yes | Send a $merge
event via the /import API with both distinct IDs |
| Simplified ID Merge | Only device→user | Send an event with both $device_id
and $user_id
(cannot merge two users) |---If you’re unsure which system your project uses, check your project settings under Identity Merge Docs: Identity Management Overview.If you need further guidance or have a complex scenario, consider reaching out to Mixpanel support.
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! 📚
You can find out which ID management system your Mixpanel project is using by navigating to your project settings: - Go to your Project Settings and look for the Identity Merge section. This will indicate whether your project is using Legacy, Original, or Simplified ID Merge. - For organization-wide defaults, Organization Owners/Admins can check the Identity Merge setting under Organization Settings.If your project already contains data, you cannot change the ID management system. For new projects (with no data), you can select the desired system in the settings before sending any data Identity Management Overview 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.
kapa.ai I have the following info displayed, what does it mean? ID Merge makes it possible to connect pre-authentication activity with an authenticated user across devices. Learn More about ID Merge This project does not have ID Merge enabled.
Let me check the knowledge base for you again. One moment! 📚
The message "This project does not have ID Merge enabled" means that your Mixpanel project is not using either the Original ID Merge or Simplified ID Merge systems. Instead, it is likely using the Legacy ID Management system, which does not support connecting pre-authentication (anonymous) activity with authenticated user activity across devices. As a result, you will not be able to merge user identities or link events from different distinct IDs for the same user in this project.If you want to use ID Merge features, you would need to create a new project and enable either the Original or Simplified ID Merge system before ingesting any data. Once data has been ingested, the ID management system cannot be changed for that project Identity Management Overview Migrating to Simplified ID Merge.
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! 📚
Yes, you can follow this approach to effectively "move" events from one distinct ID to another in Mixpanel, but there are important considerations and steps: 1. Export Events Data:
You can export raw event data for a specific distinct ID using Mixpanel’s Raw Export API or other export methods. This allows you to download all events associated with the first distinct ID Merge Mixpanel Projects.2. Delete Events from Mixpanel:
To remove the exported events from Mixpanel, you need to request deletion. However, Mixpanel’s Data Deletion tool does not support filtering by distinct ID directly. For deleting all data associated with a specific distinct ID, you should use the Distinct ID Deletion API, which is designed for this purpose Data Clean-Up.3. Modify and Re-import Events:
After exporting, update the distinct ID in your event data to the second distinct ID. Then, re-import the modified events into Mixpanel using the Import API. Make sure to include a unique $insert_id
for each event to prevent duplication Backfilling Historical Data.Important Notes:
- This process is manual and may be resource-intensive, especially for large datasets.
- Deletion requests (especially for GDPR/CCPA compliance) can take several weeks to process End User Data Management.
- When re-importing, ensure your data is formatted correctly for your project’s ID management system.Summary:
Yes, you can export events for one distinct ID, delete them from Mixpanel, and re-import them under a different distinct ID. Use the Raw Export API for export, the Distinct ID Deletion API for removal, and the Import API for re-uploading with the new ID. This approach is supported by Mixpanel’s documentation, but be aware of the limitations and processing times involved.
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! 📚
Certainly! Here are step-by-step instructions, based strictly on the available Mixpanel documentation, for exporting events from one distinct ID, deleting them, and re-importing them under a different distinct ID: ---
1. Export Events for the Original Distinct ID
Use the Raw Export API to export events. You can filter events by distinct ID using the where
parameter.**Example request:**LBKScurl --request GET \ --url '[https://data.mixpanel.com/api/2.0/export?from_date=<FROM_DATE](https://data.mixpanel.com/api/2.0/export?from_date=<FROM_DATE) &to_date=<TO_DATE> &where=properties[%22distinct_id%22]==%22ORIGINAL_DISTINCT_ID%22|https://data.mixpanel.com/api/2.0/export?from_date=<FROM_DATE> &to_date=<TO_DATE> &where=properties["distinct_id"]=="ORIGINAL_DISTINCT_ID">' \ --header 'accept: text/plain' \ --header 'authorization: Basic <YOUR_AUTH> 'LBKS
This will return all events for the specified distinct ID in JSONL format Export Methods.---
2. Delete Events for the Original Distinct ID
To delete all data associated with a specific distinct ID, use the Distinct ID Deletion API. This is the recommended approach, as the Data Deletion tool does not support filtering by distinct ID Data Clean-Up.---
3. Modify the Exported Data
Update the exported event data by replacing the original distinct ID with the new one. This can be done by processing the JSONL file and changing the value of the distinct_id
property in each event.---
4. Re-import the Modified Events
Use the Import API to upload the modified events back into Mixpanel under the new distinct ID. Make sure to include a unique $insert_id
for each event to prevent duplication Backfilling Historical Data.---
Important Notes
- Deletion requests may take several weeks to process End User Data Management. - Ensure your data is formatted correctly for your project’s ID management system before re-importing. - This process is manual and may require scripting for large datasets.---If you need to automate or script these steps, Mixpanel provides a mixpanel-utils Python module that can help with exporting and importing events Exporting Data from Mixpanel.If you have any issues or need to delete a large volume of data, you may need to contact Mixpanel support.
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.