Dealing with bad data accidentally sent to Mixpanel
A very common question for Mixpanel users is about how to delete incorrect data that was sent to Mixpanel by accident. Unfortunately, there isn’t a straightforward way to do this with precision. You can delete all your data but deleting specific events is hard.
In this post, we’ll cover some options for the precision removal of Mixpanel data through some workarounds based on your specific situation. In all situations make sure you change your implementation code to address the issue or else you’ll keep capturing faulty data.
Important: Mixpanel event data is immutable, meaning that it can’t actually be deleted from your project. So what we’re doing here is technically not deleting your events from the project, but removing bad events from the user interface and your reports.
We’re going to cover four most common scenarios of wanting to deal with bad data:
- Delete all your Mixpanel events
- Remove all instances of a specific event
- Remove Mixpanel events in a specific time range
- Remove Mixpanel events triggered by specific users
Delete all your Mixpanel events
There are currently only two ways to actually delete Mixpanel events in a way that the data is not available on Mixpanel’s servers. Either you have to submit a deletion request to Mixpanel or you have to programmatically delete all your data through one of their APIs.
These methods are for deleting all of your data, as opposed to removing a small portion of events that may be incorrect or faulty. If your goal is to remove just one event or some instances of an event, continue on to the appropriate section of this guide.
Remove all instances of a specific Mixpanel event
Sometimes you accidentally send the wrong event to your project and want to delete all instances of that particular event. While actually deleting a specific Mixpanel event from their servers isn’t possible, you can hide and drop that event from the UI, which will feel similar to an end user.
Hidden events will no longer show up in the visible part of the event dropdown list when you’re looking to add an event to a report. Instead, they will be under the “Hidden Events” section of the dropdown (shown below). Dropped events will no longer be processed by Mixpanel, even if they are still being sent. The closest you can get to deleting an event is to do both.
Step 1: Get the right access level
Hiding events can only be done by users who have “Admin” or “Owner” privileges. If you aren’t sure which one you are, just click on the gear icon on the top right of the screen. Your role will be listed right under your name.
In the screenshot below, my role is “Consumer”, which means I don’t have the right permissions to hide or drop an event.
Step 2: Find your event in Lexicon
Hiding an event is done through the “Lexicon” feature of Mixpanel. You can find it under the data management icon on the top right of your screen. When you go to Lexicon, search for the event you want to delete.
Step 3: Hide and drop your event in Lexicon
When you find your event, check the box to the left of it. A button will appear on the top of the screen that says “Hide”. Click that button and confirm to hide your event. Then drop the same event using the “Drop” button.
In the image below, the “Bundle Landing Page” is selected for hiding and dropping.
Step 4: Make sure the faulty code is removed
It’s great to remove an event from the Mixpanel user interface, but a long-term solution is to also keep the faulty event from being sent to Mixpanel. Ask your engineering team to fix the issue that caused the faulty event data, so you don’t have to deal with it again in the future.
Remove Mixpanel events in a specific time range
Sometimes you accidentally trigger an event a whole bunch of times, which can really mess up your reports. The other instances of that event are fine, you just don’t want the ones that were triggered in a specific time range.
As we’ve mentioned before, Mixpanel doesn’t provide a way to actually delete a subset of your events. However, there is a workaround that effectively accomplishes the same thing using the “Custom Events” feature.
What we’re going to do here is to create a copy of the existing event that excludes all the faulty data, and then use this new clean event instead of the old one. The downside to this method is that you will have to go through your existing reports and replace the old event with the new one.
Step 1: Open the “Custom Event” creator
The easiest way to reach the custom event creator is to open the dropdown for adding events in any of the reports. The “Create Custom Event” button will be at the very bottom of the dropdown list.
Step 2: Add your event and an inline filter
In the custom event creator, add the faulty event. Then hover over the event so the filter icon appears (shown in the red box in the image below). Click it to add a filter.
Step 3: Filter out the date range that contains faulty data
From the dropdown menu, select the “Time” property. This refers to the time the event was triggered. The default time range filter is “Last 7 days”. Click on Last and change it to “Not Between”. Then select the date range containing faulty data, so the event only tracks any dates outside of that.
Step 4: Name your new event, save it, and share it
Give your event a name. I like to keep the original name and just add “(Fixed)” at the end. Click the “Save” button to complete your event creation. Note that this only saves the event for you. If you want to share access to this custom event with others in your project, click the “Save and Share” button instead and give access to your whole project.
Step 5: Hide the old event
Now that you’ve created a new event that leaves out the faulty data, you should remove the old event so that it doesn’t get accidentally used by your teammates.
The process is exactly as outlined in our section about removing all instances of an event:
- Go to Lexicon and find your event
- Check the box next to it and choose the “Hide” and “Drop” options
Now you have a new event without any of the faulty data, and your old event is hidden. Make sure you update the code snippets in your product so you no longer get any faulty data.
Remove Mixpanel events triggered by specific users
Sometimes all the faulty events were triggered by one or several users. In a situation like this, you have to take a very similar approach to what we did for faulty events that were triggered in a specific time range. In fact, the only thing that’s different is the filter applied in step 3 of the project.
Step 1: Open the “Custom Event” creator
The easiest way to reach the custom event creator is to open the dropdown for adding events in any of the reports. The “Create Custom Event” button will be at the very bottom of the dropdown list.
Step 2: Add your event and an inline filter
In the custom event creator, add the faulty event. Then hover over the event so the filter icon appears (shown in the red box in the image below). Click it to add a filter.
Step 3: Filter out the users who caused the faulty data
From the dropdown menu, select a property that you can use to identify your users. In this example, we’ll pick the email address property. This tracks the email address of the user that triggered the event. Click the default “Is” option and change it to “Is Not”. Then select the users that triggered the faulty data.
The final step is just like step 4 of the section above. Name your event, save it, and share it with the other users in your project.
Step 4: Name your new event, save it, and share it
Give your event a name. I like to keep the original name and just add “(Fixed)” at the end. Click the “Save” button to complete your event creation. Note that this only saves the event for you. If you want to share access to this custom event with others in your project, click the “Save and Share” button instead and give access to your whole project.
Step 5: Hide the old event
Now that you’ve created a new event that leaves out the faulty data, you should remove the old event so that it doesn’t get accidentally used by your teammates.
The process is exactly as outlined in our section about removing all instances of an event:
- Go to Lexicon and find your event
- Check the box next to it and choose the “Hide” and “Drop” options
Now you have a new event without any of the faulty data, and your old event is hidden. Make sure you update the code snippets in your product so you no longer get any faulty data.
Final Notes
There you have it! That should help you deal with having bad data in Mixpanel.
Remember what we stated at the beginning of this article: Mixpanel data is immutable, meaning that unless you put in a request to delete all your data, none of your events are actually deleted. What we’re doing here is accomplishing the same effect as deleting your events using clever workarounds that remove the bad data from your reports.
We hope you enjoyed this. If you want to improve your product analytics skills (including Mixpanel) even further, check out our Ultimate Product Analytics Course. It’ll teach you everything you need, and nothing that you don’t.
And if you need any kind of help with your company’s Mixpanel implementation, send us a message here. We’re the highest-rated Mixpanel consulting agency in the world, and we work with companies of all sizes and industries.