michaelcarter / mixpanel-data-export-js

Mixpanel data export js
91 stars 38 forks source link

Multiseg feature worth adding? #25

Closed JuanCaicedo closed 7 years ago

JuanCaicedo commented 8 years ago

I'm going to make a fork that incorporates the ability to hit the /segmentation/multiseg endpoint. This is an undocumented endpoint that gets hit within the UI if you want to segment along two properties instead of one.

From my conversations with Mixpanel support, they said this endpoint is undocumented because they are still developing it and it is subject to change at any time. Given this is the case, is it something that you would be interested in bringing back into this project, or is it outside the scope of what you want to handle?

michaelcarter commented 8 years ago

This project seems to have had a few requests for support of undocumented endpoints, I've previously drawn the line at including them as I don't really have the time to support undocumented features 'subject to change at any time'.

Could the panel.get(['path','to','method'], methodParams) feature help you here? All the authentication for your request will still be handled, it just allows you to call undocumented methods API features. See how all of our the 'supported' features are built up using it: https://github.com/michaelcarter/mixpanel-data-export-js/blob/master/src/mixpanel_data_export.js#L32

If you think that's not really practical and there's additional logic that needs to be baked into the client to properly support this, it might be time I surrender this fight and begin to include these features within a panel.undocumented namespace within this project so people can use them with some expectation that they might be a bit broken.

What do you think?

JuanCaicedo commented 8 years ago

That's what I ended up doing in the end

diff --git a/src/mixpanel_data_export.js b/src/mixpanel_data_export.js
index 3106ea5..4db9b02 100644
--- a/src/mixpanel_data_export.js
+++ b/src/mixpanel_data_export.js
@@ -86,6 +86,10 @@ var MixpanelExport = (function() {
     return this.get(["segmentation"], parameters, callback);
   };

+  MixpanelExport.prototype.multiseg = function(parameters, callback) {
+    return this.get(["segmentation/multiseg"], parameters, callback);
+  };
+
   MixpanelExport.prototype.numericSegmentation = function(parameters, callback) {
     return this.get(["segmentation", "numeric"], parameters, callback);
   };

I think I agree with you that it's probably not the best to support undocumented endpoints. I can add a note to the docs about how to use get for those endpoints