Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to export Mixpanel events, segmented by time?

Tags:

mixpanel

Besides "from and to date", I'd like to further segment event info from the Mixpanel export() API method by their times ( events contain a 'time' property, expressed as a unix timestamp ); but, eg, when I specify a "where" param, I get an empty response ( see below ).

"where" param = 'properties["time"] >= 1401642000'

I definitely have events that match this. Should this be working ?

no "where" param:

args = {'from_date': '2014-06-01', 'api_key': 'REDACTED', 'sig': 'REDACTED', 'to_date': '2014-06-04', 'expire': 1402424767}

response = [ I receive expected events ]


'where' param = 'properties["time"] >= 1401642000'

args = {'from_date': '2014-06-01', 'expire': 1402424767, 'sig': 'REDACTED', 'to_date': '2014-06-04', 'api_key': 'REDACTED', 'where': 'properties["time"] >= 1401642000'}

response = [ HTTP request succeeds, but response is empty ]


Same as above, except putting time value in quotes:

'where' param = 'properties["time"] >= "1401642000"'

args = {'from_date': '2014-06-01', 'expire': 1402424767, 'sig': 'REDACTED', 'to_date': '2014-06-04', 'api_key': 'REDACTED', 'where': 'properties["time"] >= "1401642000"'}

response = [ HTTP request succeeds, but response is empty ]


Try casting properties["time"] to a number:

'where' param = 'number(properties["time"]) >= 1401642000'

args = {'from_date': '2014-06-01', 'expire': 1402424767, 'sig': 'REDACTED', 'to_date': '2014-06-04', 'api_key': 'REDACTED', 'where': 'number(properties["time"]) >= 1401642000'}

response = [ HTTP request succeeds, but response is empty ]

like image 305
pkstack Avatar asked Nov 11 '22 06:11

pkstack


1 Answers

I ran into the same problem on this API and tried various solutions before contacting their customer support. Their response was as follows:

"The bad news is that there's unfortunately no way to selectively export events from a particular time through the export API. This is largely due to the fact that time is not one of the exposed properties on your events to the API. The only properties that are exposed within the export API are the properties that were sent in with your events and actually exposed within the UI."

However, he went on to point out their newer JQL system https://mixpanel.com/help/reference/jql which can apparently filter on things like time.

Hope that helps.

like image 84
Grant Avatar answered Jan 04 '23 01:01

Grant