Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mixpanel-data-export

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mixpanel-data-export

A wrapper for Mixpanel's data export API. Simply instantiate the class with your API secret and key and then make calls to api methods and get json back.

  • 1.8.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
493
increased by101.22%
Maintainers
1
Weekly downloads
 
Created
Source

Mixpanel Data Export (v 1.8.1)

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 correctly formatted data back via a promise, callback or stream.

Installation

Node:

var MixpanelExport = require('mixpanel-data-export');

Browser (self-hosted):

<script src="your/path/to/mixpanel_data_export.min.js"></script>

Usage Instructions

Every method detailed on mixpanel's data export api page is available in the library. However, some of the namings have been adjusted to read more semantically, for example, topEventProperties , and eventPropertyValues.

The full list of methods is as follows:

An example usage might be:

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

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

Callbacks are also supported:

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.

Streaming Exports

Due to the large size of an export response, it's often appropriate to stream the data instead of waiting for it all:

// Create a stream object
var exportStream = panel.exportStream({
    from_date: "2015-03-01",
    to_date: "2015-03-02"
});

// Listen on stream data
exportStream.on('data', function(data) {
  // do something with it
});

// Listen for a stream error
exportStream.on('error', function(err) {
  // handle error
});

// Listen for the end of the stream
exportStream.on('end', function() {
  // move on to do other stuff
});

// Pause the stream
exportStream.pause()

// Resume the stream
exportStream.resume()

Please note this option is not available in node environments, it's not supported in browser.

Keywords

FAQs

Package last updated on 12 Jul 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc