Question

We want to export users data along with all the events as per user, does anyone have any idea how can i get it??

  • 17 October 2019
  • 1 reply
  • 223 views

Badge

We have written below JQL query but it's not working can you please help us with this..

var params = {


from_date: '2019-06-13',


to_date: '2019-06-14'


}


function main() {


var peopleCollection = People();


var collectionEvents = Events({


from_date: params.from_date,


to_date: params.to_date


})


.joinByuser(function(collectionEvents, peopleCollection) {


var array = Array();


for (var i = 0; i < peopleCollection.length; i++) {


for (j = 0; j < collectionEvents.length; j++) {


if (peopleCollection[i].distinct_id == collectionEvents[j].distinct_id) {


array.map[collectionEvents[j]];


}


}


}



return eventarray }


);


}




1 reply

Userlevel 1
Badge

@farhan People and events data are stored separately. Exporting from the User side of the platform (https://mixpanel.com/docs/api-documentation/data-export-api#engage-default) will allow you let you export your User Profiles (distinct_ids and all User properties), but it won't give you your users' event history.

On the other hand, using the raw data export (https://mixpanel.com/docs/api-documentation/data-export-api) will allow you to export all event data.

It looks like you are using JQL to export your event data. I the following JQL query should pull up the event data within the date range you note on the query along with the users DistinctID to map back to the user profile.

function main() {
  return Events({
    from_date: '2019-10-01',
    to_date:   '2019-10-22'
  })

}

I have done some exports before and some things to note is that your data history may be limited to the type of plan you have. I would take a look at their pricing page to see what history comes with your plan.

Another thing would be to keep an eye out on how much data is coming with each request. If it is a high volume request, I would export data in month chunks so you will not hit a rate limit.

Hopes this helps you Farhan!


Reply