-
Notifications
You must be signed in to change notification settings - Fork 38
/export missing? #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Sorry for the very late reply. It's a new endpoint, so it's been snuck on since the last update to this library! Unfortunately it also seems to work a little differently from the others so it's not completely trivial to add it to my library. From the mixpanel site:
Specifically the whole "not returning JSON" thing is a bit of a pain for me, I'll endeavour to add support for this endpoint this week though, as I have some free time. |
yes - the invalid json is a pain. There is no enclosing braces and no comma's between the event objects. |
Hi !!! I juste played with this endpoint but it seems to be quite tricky to get this on browser... Firstly, I wrote a function to transform the returned data in JS object : function buildResult(strValue){
if(strValue){
// add ',' at the end of all lines
var step1 = strValue.replace(new RegExp('\n', 'g'), ',');
// put data in an array
var step2 = '['+step1+']';
// remove last ',' to get a correct array
var step3 = step2.replace(',]', ']');
// parse json and return JS object
return JSON.parse(step3);
}
} But now I'm struggling with jsonp in browser... My Angular code : var mixpanel = new MixpanelExport({
api_key: credentials.api_key,
api_secret: credentials.api_secret,
api_stub: 'http://data.mixpanel.com/api/2.0/'
});
var url = mixpanel._buildRequestURL(['export'], params);
$http.jsonp(url+'calback=?', {
transformResponse: function(data, headers){
return buildResult(data);
}
}).then(function(result){
return result.data;
}); Any hint to get this working ? I also tried with the var mixpanel = new MixpanelExport({
api_key: credentials.api_key,
api_secret: credentials.api_secret,
api_stub: 'http://data.mixpanel.com/api/2.0/'
});
mixpanel.get(['export'], params, function(data){
console.log('data', data);
}); Any idea why ? Thanks for helping ! |
Hi all. I finally got around to looking at this (several months on, eek!) I've managed to get the export endpoint working for node.js stuff and have included that in the master branch (thanks @loicknuchel for your function there). I've had no luck with the jsonp callback clientside though, so I'm going to email the guys at Mixpanel and see what's up. Thanks for your patience. |
Thanks for your work ! |
Ok, Mixpanel got back to me. Basically the export endpoint doesn't support jsonp, this was a deliberate move as it's not designed to be used in the browser. That said, if you pull down a copy of this repository and remove the error thrown from the source code for the export endpoint (line I don't know if that helps at all... sorry @loicknuchel! If you're just doing some local analysis them perhaps write a quick node script for this? |
Thanks for your helpful response. I will probably create a proxy server to transform data in json... |
Was the /export endpoint left out intentionally? I'm poking around and can't seem to find it. Thanks!
The text was updated successfully, but these errors were encountered: