New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mixpanel

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mixpanel - npm Package Compare versions

Comparing version 0.0.18 to 0.0.19

6

example.js

@@ -42,2 +42,8 @@ // grab the Mixpanel factory

// append value to a list
mixpanel.people.append("billybob", "awards", "Great Player");
// append multiple values to a list
mixpanel.people.append("billybob", {"awards": "Great Player", "levels_finished": "Level 4"});
// record a transaction for revenue analytics

@@ -44,0 +50,0 @@ mixpanel.people.track_charge("billybob", 39.99);

@@ -335,2 +335,44 @@ /*

/**
people.append(distinct_id, prop, value, callback)
---
Append a value to a list-valued people analytics property.
usage:
// append a value to a list, creating it if needed
mixpanel.people.append('pages_visited', 'homepage');
// like mixpanel.people.set(), you can append multiple properties at once:
mixpanel.people.append({
list1: 'bob',
list2: 123
});
*/
append: function(distinct_id, prop, value, callback) {
var $append = {};
if (typeof(prop) === 'object') {
callback = value;
Object.keys(prop).forEach(function(key) {
$append[key] = prop[key];
});
} else {
$append[prop] = value;
}
var data = {
'$append': $append,
'$token': metrics.token,
'$distinct_id': distinct_id
};
if(metrics.config.debug) {
console.log("Sending the following data to Mixpanel (Engage):");
console.log(data);
}
metrics.send_request('/engage', data, callback);
},
/**
people.track_charge(distinct_id, amount, properties, callback)

@@ -337,0 +379,0 @@ ---

2

package.json

@@ -5,3 +5,3 @@ {

"keywords": ["mixpanel", "analytics", "api", "stats"],
"version": "0.0.18",
"version": "0.0.19",
"homepage": "https://github.com/carlsverre/mixpanel-node",

@@ -8,0 +8,0 @@ "author": "Carl Sverre",

@@ -52,2 +52,8 @@ Mixpanel-node

// append value to a list
mixpanel.people.append("billybob", "awards", "Great Player");
// append multiple values to a list
mixpanel.people.append("billybob", {"awards": "Great Player", "levels_finished": "Level 4"});
// record a transaction for revenue analytics

@@ -104,2 +110,3 @@ mixpanel.people.track_charge("billybob", 39.99);

- [sandinmyjoints](https://github.com/sandinmyjoints)
- [Jyrki Laurila](https://github.com/jylauril)

@@ -106,0 +113,0 @@ License

@@ -213,2 +213,40 @@ var Mixpanel = require('../lib/mixpanel-node'),

append: {
"calls send_request with correct endpoint and data": function(test) {
var expected_data = {
$append: { key1: 'value' },
$token: this.token,
$distinct_id: this.distinct_id
};
this.mixpanel.people.append(this.distinct_id, 'key1', 'value');
test.ok(
this.mixpanel.send_request.calledWithMatch(this.endpoint, expected_data),
"people.append didn't call send_request with correct arguments"
);
test.done();
},
"supports appending multiple keys with values": function(test) {
var prop = { key1: 'value1', key2: 'value2' },
expected_data = {
$append: prop,
$token: this.token,
$distinct_id: this.distinct_id
};
this.mixpanel.people.append(this.distinct_id, prop);
test.ok(
this.mixpanel.send_request.calledWithMatch(this.endpoint, expected_data),
"people.append didn't call send_request with correct arguments"
);
test.done();
}
},
track_charge: {

@@ -215,0 +253,0 @@ "calls send_request with correct endpoint and data": function(test) {

Sorry, the diff of this file is not supported yet

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