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.1 to 1.0.2

41

npm/lib/mixpanel_data_export.js

@@ -15,4 +15,4 @@ var CryptoJS = require("cryptojs").Crypto;

this.api_secret = this.opts.api_secret;
this.api_stub = "http://mixpanel.com/api/2.0/" || this.opts.api_stub;
this.timeout_after = 10 || this.opts.timeout_after;
this.api_stub = this.opts.api_stub || "//mixpanel.com/api/2.0/";
this.timeout_after = this.opts.timeout_after || 10;
}

@@ -24,2 +24,3 @@

// Remove in a later release.
MixpanelExport.prototype.top_events = function(parameters) {

@@ -29,2 +30,6 @@ return this.get(["events", "top"], parameters);

MixpanelExport.prototype.topEvents = function(parameters) {
return this.get(["events", "top"], parameters);
};
MixpanelExport.prototype.names = function(parameters) {

@@ -38,2 +43,3 @@ return this.get(["events", "names"], parameters);

// Remove in a later release.
MixpanelExport.prototype.top_properties = function(parameters) {

@@ -43,2 +49,6 @@ return this.get(["events", "properties", "top"], parameters);

MixpanelExport.prototype.topProperties = function(parameters) {
return this.get(["events", "properties", "top"], parameters);
};
MixpanelExport.prototype.values = function(parameters) {

@@ -83,3 +93,3 @@ return this.get(["events", "properties", "values"], parameters);

result = {
request_url: this._build_request_url(method, parameters),
request_url: this._buildRequestURL(method, parameters),
req: new XMLHttpRequest,

@@ -103,7 +113,7 @@ done: function(data) {

MixpanelExport.prototype._build_request_url = function(method, parameters) {
return "" + this.api_stub + ((typeof method.join === "function" ? method.join("/") : void 0) || method) + "/?" + (this._request_parameter_string(parameters));
MixpanelExport.prototype._buildRequestURL = function(method, parameters) {
return "" + this.api_stub + ((typeof method.join === "function" ? method.join("/") : void 0) || method) + "/?" + (this._requestParameterString(parameters));
};
MixpanelExport.prototype._request_parameter_string = function(args) {
MixpanelExport.prototype._requestParameterString = function(args) {
var connection_params, keys, sig_keys;

@@ -117,17 +127,17 @@ connection_params = this._extend({

sig_keys = this._without(keys, "callback");
return this._get_parameter_string(keys, connection_params) + "&sig=" + this._get_signature(sig_keys, connection_params);
return this._getParameterString(keys, connection_params) + "&sig=" + this._getSignature(sig_keys, connection_params);
};
MixpanelExport.prototype._get_parameter_string = function(keys, connection_params) {
MixpanelExport.prototype._getParameterString = function(keys, connection_params) {
var _this = this;
return this._map(keys, (function(key) {
return "" + key + "=" + (_this._url_encode(connection_params[key]));
return "" + key + "=" + (_this._urlEncode(connection_params[key]));
})).join("&");
};
MixpanelExport.prototype._get_signature = function(keys, connection_params) {
MixpanelExport.prototype._getSignature = function(keys, connection_params) {
var sig,
_this = this;
sig = this._map(keys, (function(key) {
return "" + key + "=" + (_this._sig_encode(connection_params[key]));
return "" + key + "=" + (_this._sigEncode(connection_params[key]));
})).join("") + this.api_secret;

@@ -137,11 +147,11 @@ return CryptoJS.MD5(sig);

MixpanelExport.prototype._url_encode = function(param) {
MixpanelExport.prototype._urlEncode = function(param) {
if (Array.isArray(param)) {
return encodeURIComponent(JSON.stringify(param));
} else {
return param;
return encodeURIComponent(param);
}
};
MixpanelExport.prototype._sig_encode = function(param) {
MixpanelExport.prototype._sigEncode = function(param) {
if (Array.isArray(param)) {

@@ -196,3 +206,2 @@ return JSON.stringify(param);

module.exports = MixpanelExport
module.exports = MixpanelExport;
{
"name": "mixpanel-data-export",
"version": "v1.0.1",
"version": "v1.0.2",
"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.",

@@ -5,0 +5,0 @@ "keywords": ["mixpanel", "api", "export", "data", "analytics"],

@@ -17,4 +17,25 @@ Mixpanel Data Export

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.
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()`.
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)`
An example usage might be:
```javascript

@@ -21,0 +42,0 @@ panel = new MixpanelExport({

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