/mixpanel-data-export-js

Mixpanel data export js

Primary LanguageJavaScript

Mixpanel Data Export (v 1.2.0)

Introduction

Simply put, this is a JavaScript library that makes Mixpanel's data export API easy to use. Simply instantiate the class with your API secret and key and then make calls to api methods and get data back in a callback.

NPM Usage

The npm name for the library is mixpanel-data-export, and you can use it just as you would below, with the standard var MixpanelExport = require('mixpanel-data-export');.

General Usage Instructions

Every method detailed on mixpanel's data export api page is available in the library. However, where the top method is duplicated the method name has a specifier appended, so we get methods like topProperties(), and topEvents().

The full list of methods is as follows:

  • events(paramters, callback)
  • topEvents(paramters, callback)
  • names(paramters, callback)
  • properties(parameters, callback)
  • topProperties(parameters, callback)
  • values(parameters, callback)
  • funnels(parameters, callback)
  • list(parameters, callback)
  • segmentation(parameters, callback)
  • numeric(parameters, callback)
  • sum(paramters, callback)
  • average(parameters, callback)
  • retention(parameters, callback)
  • engage(parameters, callback)

An example usage might be:

panel = new MixpanelExport({
  api_key: "my_api_key",
  api_secret: "my_api_secret"
});

result = panel.retention({
  from_date: "2014-02-28",
  to_date: "2014-03-10",
  born_event: "Rendering items"
}, function(data) {
  console.log(data);
});

A full list of available API methods is detailed on mixpanel's data export api page. If you find any that are missing please let me know, or better yet put in a pull request.

Dependencies (only a concern for implementing in browser)

Currently, this requires the following libraries:

<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/md5.js"></script>
<script src="mixpanel_data_export_min.js"></script>