Skip to content

Instantly share code, notes, and snippets.

@pentestfail
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pentestfail/9c7fd0fb99aaefcd0dd5 to your computer and use it in GitHub Desktop.
Save pentestfail/9c7fd0fb99aaefcd0dd5 to your computer and use it in GitHub Desktop.
Mixpanel data export

#Dead simple Mixpanel data export as JSON

Leverages "mixpanel-query-py" to access the Mixpanel Data Export API. See https://github.com/cooncesean/mixpanel-query-py for details on this python binding to retrieve events, etc.

#To install mixpanel-query-py pip install mixpanel-query-py

import json
from datetime import datetime, timedelta
from mixpanel_query.client import MixpanelQueryClient
#Enter your Mixpanel API Keys
MIXPANEL_API_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
MIXPANEL_API_SECRET = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
# Instantiate the client
query_client = MixpanelQueryClient(MIXPANEL_API_KEY, MIXPANEL_API_SECRET)
# Query your project's data by specifying the dates as follows
data = query_client.get_export('2015-01-01', '2015-01-02')
#Mixpanel export provides each
for x in data:
print json.dumps(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment