Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mixpanel - Bulk delete old users

Tags:

mixpanel

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?

like image 261
henry.oswald Avatar asked Sep 27 '13 11:09

henry.oswald


People also ask

How do I remove data from mixpanel?

Event data is immutable in Mixpanel, which means it cannot be edited or deleted once it's been sent to your project.

How do I export Users from mixpanel?

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.


2 Answers

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.

like image 169
stpe Avatar answered Sep 22 '22 04:09

stpe


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.

like image 44
Ishai Jaffe Avatar answered Sep 24 '22 04:09

Ishai Jaffe