I am about to go into the next plan in mixpanel for having too many people and would like to delete some old users first.
Is there a simple way/script/api to bulk delete old users?
Event data is immutable in Mixpanel, which means it cannot be edited or deleted once it's been sent to your project.
To download your user profiles from the Users page, simply click the Export icon. This will download all the profile data being displayed in the current report - to download more properties, edit your columns to select more properties.
I've written two scripts that may come in handy; mixpanel-engage-query and mixpanel-engage-post.
Using the first script (query) you can query your People Data and get a list of profiles, e.g. all users who have $last_seen set to a date older than X months.
Using the second script (post) you can perform actions in batch on those profiles, for example deleting them. See the README for an example of how to perform a batch delete.
Using the Mixpanel-api python Module
pip install mixpanel-api
This script will delete any profile that hasn't been seen since January 1st, 2019:
from mixpanel_api import Mixpanel
mixpanel = Mixpanel('MIXPANEL_SECRET', token='MIXPANEL_TOKEN')
deleted_count = mixpanel.people_delete(query_params={ 'selector' : 'user["$last_seen"]<"2019-01-01T00:00:00"'})
print(deleted_count)
Replace MIXPANEL_SECRET and MIXPANEL_TOKEN with your own project tokens.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With