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 - npm Package Compare versions

Comparing version 1.0.3 to 1.2.0

113

npm/lib/mixpanel_data_export.js

@@ -1,2 +0,2 @@

var CryptoJS = require("cryptojs").Crypto;
var CryptoJS = require("cryptojs").Crypto;
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;

@@ -11,3 +11,3 @@

if (!(this.opts.api_key && this.opts.api_secret)) {
throw "Error: api_key and api_secret must be passed to Mixpanel constructor.";
throw "Error: api_key and api_secret must be passed to MixpanelExport constructor.";
}

@@ -20,88 +20,79 @@ this.api_key = this.opts.api_key;

MixpanelExport.prototype.events = function(parameters) {
return this.get("events", parameters);
MixpanelExport.prototype.events = function(parameters, callback) {
return this.get("events", parameters, callback);
};
// Remove in a later release.
MixpanelExport.prototype.top_events = function(parameters) {
return this.get(["events", "top"], parameters);
MixpanelExport.prototype.topEvents = function(parameters, callback) {
return this.get(["events", "top"], parameters, callback);
};
MixpanelExport.prototype.topEvents = function(parameters) {
return this.get(["events", "top"], parameters);
MixpanelExport.prototype.names = function(parameters, callback) {
return this.get(["events", "names"], parameters, callback);
};
MixpanelExport.prototype.names = function(parameters) {
return this.get(["events", "names"], parameters);
MixpanelExport.prototype.properties = function(parameters, callback) {
return this.get(["events", "properties"], parameters, callback);
};
MixpanelExport.prototype.properties = function(parameters) {
return this.get(["events", "properties"], parameters);
MixpanelExport.prototype.topProperties = function(parameters, callback) {
return this.get(["events", "properties", "top"], parameters, callback);
};
// Remove in a later release.
MixpanelExport.prototype.top_properties = function(parameters) {
return this.get(["events", "properties", "top"], parameters);
MixpanelExport.prototype.values = function(parameters, callback) {
return this.get(["events", "properties", "values"], parameters, callback);
};
MixpanelExport.prototype.topProperties = function(parameters) {
return this.get(["events", "properties", "top"], parameters);
MixpanelExport.prototype.funnels = function(parameters, callback) {
return this.get(["funnels"], parameters, callback);
};
MixpanelExport.prototype.values = function(parameters) {
return this.get(["events", "properties", "values"], parameters);
MixpanelExport.prototype.list = function(parameters, callback) {
return this.get(["funnels", "list"], parameters, callback);
};
MixpanelExport.prototype.funnels = function(parameters) {
return this.get(["funnels"], parameters);
MixpanelExport.prototype.segmentation = function(parameters, callback) {
return this.get(["segmentation"], parameters, callback);
};
MixpanelExport.prototype.list = function(parameters) {
return this.get(["funnels", "list"], parameters);
MixpanelExport.prototype.numeric = function(parameters, callback) {
return this.get(["segmentation", "numeric"], parameters, callback);
};
MixpanelExport.prototype.segmentation = function(parameters) {
return this.get(["segmentation"], parameters);
MixpanelExport.prototype.sum = function(parameters, callback) {
return this.get(["segmentation", "sum"], parameters, callback);
};
MixpanelExport.prototype.numeric = function(parameters) {
return this.get(["segmentation", "numeric"], parameters);
MixpanelExport.prototype.average = function(parameters, callback) {
return this.get(["segmentation", "average"], parameters, callback);
};
MixpanelExport.prototype.sum = function(parameters) {
return this.get(["segmentation", "sum"], parameters);
MixpanelExport.prototype.retention = function(parameters, callback) {
return this.get(["retention"], parameters, callback);
};
MixpanelExport.prototype.average = function(parameters) {
return this.get(["segmentation", "average"], parameters);
MixpanelExport.prototype.engage = function(parameters, callback) {
return this.get(["engage"], parameters, callback);
};
MixpanelExport.prototype.retention = function(parameters) {
return this.get(["retention"], parameters);
};
MixpanelExport.prototype.engage = function(parameters) {
return this.get(["engage"], parameters);
};
MixpanelExport.prototype.get = function(method, parameters) {
var result;
result = {
request_url: this._buildRequestURL(method, parameters),
req: new XMLHttpRequest,
done: function(data) {
throw "[MixpanelExport] You must implement the .done(json) method on the result of your API call!";
},
get: function() {
var _this = this;
this.req.open("get", this.request_url, true);
this.req.onload = function() {
result = JSON.parse(_this.req.responseText);
return _this.done(result);
};
return this.req.send();
MixpanelExport.prototype.get = function(method, parameters, callback) {
// JSONP
if (typeof window === 'object') {
var requestUrl = this._buildRequestURL(method, parameters) + "&callback=mpSuccess";
window.mpSuccess = callback;
var script = document.createElement("script");
script.src = requestUrl;
document.getElementsByTagName("head")[0].appendChild(script);
}
// Node
else {
var requestUrl = this._buildRequestURL(method, parameters)
var request = new XMLHttpRequest;
var success = function() {
result = JSON.parse(this.responseText);
callback(result);
}
};
result.get();
return result;
request.onload = success;
request.open("get", requestUrl, true);
request.send();
}
};

@@ -117,4 +108,3 @@

api_key: this.api_key,
expire: this._timeout(),
callback: ""
expire: this._timeout()
}, args);

@@ -126,2 +116,3 @@ keys = this._keys(connection_params).sort();

MixpanelExport.prototype._getParameterString = function(keys, connection_params) {

@@ -128,0 +119,0 @@ var _this = this;

{
"name": "mixpanel-data-export",
"version": "v1.0.3",
"version": "v1.2.0",
"description": "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.",
"keywords": ["mixpanel", "api", "export", "data", "analytics"],
"dependencies":
{
"cryptojs": ">=2.5.3",
"xmlhttprequest": ">=1.5.0"
},
"keywords": [
"mixpanel",
"api",
"export",
"data",
"analytics"
],
"dependencies": {
"cryptojs": ">=2.5.3",
"xmlhttprequest": ">=1.5.0"
},
"homepage": "https://github.com/michaelcarter/mixpanel-data-export-js",
"bugs":
{
"url": "https://github.com/michaelcarter/mixpanel-data-export-js/issues",
"email": "mike@mcarter.me"
},
"bugs": {
"url": "https://github.com/michaelcarter/mixpanel-data-export-js/issues",
"email": "mike@mcarter.me"
},
"license": "MIT",
"author":
{
"name" : "Mike Carter",
"email" : "mike@mcarter.me",
"url" : "http://mcarter.me/"
},
"files": ["npm/lib"],
"author": {
"name": "Mike Carter",
"email": "mike@mcarter.me",
"url": "http://mcarter.me/"
},
"files": [
"npm/lib"
],
"main": "npm/lib/mixpanel_data_export.js",
"repository":
{
"type": "git",
"url": "https://github.com/michaelcarter/mixpanel-data-export-js.git"
}
}
"repository": {
"type": "git",
"url": "https://github.com/michaelcarter/mixpanel-data-export-js.git"
},
"devDependencies": {
"grunt": "~0.4.2",
"grunt-cli": "~0.1.13",
"mocha": "~1.17.1"
}
}

@@ -1,3 +0,3 @@

Mixpanel Data Export
====================
Mixpanel Data Export (v 1.2.0)
==============================

@@ -7,3 +7,3 @@ Introduction

Simply put, this is a JavaScript class that makes [Mixpanel's data export API](https://mixpanel.com/docs/api-documentation/data-export-api#libs-js) easy to use. Simply instantiate the class with your API secret and key and then make calls to api methods and get objects back. A NPM is also provided for noders.
Simply put, this is a JavaScript library that makes [Mixpanel's data export API](https://mixpanel.com/docs/api-documentation/data-export-api#libs-js) 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.

@@ -13,3 +13,3 @@ NPM Usage

The npm name for the library is [mixpanel-data-export](https://npmjs.org/package/mixpanel-data-export), and you can use it just as you would below, with the standard `var MixpanelExport = require('mixpanel-data-export');` added at the beginning of your file.
The npm name for the library is [mixpanel-data-export](https://npmjs.org/package/mixpanel-data-export), and you can use it just as you would below, with the standard `var MixpanelExport = require('mixpanel-data-export');`.

@@ -19,24 +19,22 @@ General Usage Instructions

Every method detailed on [mixpanel's data export api page](https://mixpanel.com/docs/api-documentation/data-export-api#libs-js) is available in the library. However, where the `top` method is duplicated the method name has a specifier appended, so those are `topProperties()`, and `topEvents()`.
Every method detailed on [mixpanel's data export api page](https://mixpanel.com/docs/api-documentation/data-export-api#libs-js) 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)`
- `top_events(paramters)` (synonymous to topEvents)
- `topEvents(paramters)`
- `names(paramters)`
- `properties(parameters)`
- `top_properties(parameters)` (synonymous to topProperties)
- `topProperties(parameters)`
- `values(parameters)`
- `funnels(parameters)`
- `list(parameters)`
- `segmentation(parameters)`
- `numeric(parameters)`
- `sum(paramters)`
- `average(parameters)`
- `retention(parameters)`
- `engage(parameters)`
- `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:
An example usage might be:

@@ -50,8 +48,6 @@ ```javascript

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

@@ -63,9 +59,13 @@ });

Dependencies
------------
Dependencies (only a concern for implementing in browser)
---------------------------------------------------------
Currently, this requires the following libraries:
Currently, this requires the following libraries:
- [CryptoJS's MD5 implementation](https://code.google.com/p/crypto-js/)
- [XmlHttpRequest](https://npmjs.org/package/xmlhttprequest) (NPM Only)
- [CryptoJS's MD5 implementation](https://code.google.com/p/crypto-js/) This will just need to be under the CryptoJS namespace when used in a browser. A simple inclusion may look like:
```html
<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>
```
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