Comparing version 0.0.20 to 0.1.0
{ | ||
"name": "mixpanel", | ||
"description": "A simple API for mixpanel", | ||
"keywords": ["mixpanel", "analytics", "api", "stats"], | ||
"version": "0.0.20", | ||
"homepage": "https://github.com/carlsverre/mixpanel-node", | ||
"keywords": [ | ||
"mixpanel", | ||
"analytics", | ||
"api", | ||
"stats" | ||
], | ||
"version": "0.1.0", | ||
"homepage": "https://github.com/mixpanel/mixpanel-node", | ||
"author": "Carl Sverre", | ||
@@ -13,7 +18,7 @@ "main": "lib/mixpanel-node", | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/carlsverre/mixpanel-node.git" | ||
"type": "git", | ||
"url": "http://github.com/mixpanel/mixpanel-node.git" | ||
}, | ||
"engines": { | ||
"node": ">=0.6.0" | ||
"node": ">=0.10.0" | ||
}, | ||
@@ -24,5 +29,5 @@ "scripts": { | ||
"devDependencies": { | ||
"nodeunit": "0.7", | ||
"sinon": "1.4" | ||
"nodeunit": "^0.9.1", | ||
"sinon": "^1.14.1" | ||
} | ||
} |
112
readme.md
Mixpanel-node | ||
============= | ||
[![Build Status](https://secure.travis-ci.org/carlsverre/mixpanel-node.png)](http://travis-ci.org/carlsverre/mixpanel-node) | ||
[![Build Status](https://travis-ci.org/mixpanel/mixpanel-node.svg?branch=master)](https://travis-ci.org/mixpanel/mixpanel-node) | ||
@@ -15,71 +15,76 @@ This library provides many of the features in the official javascript mixpanel library. It is easy to use, and fully async. | ||
// grab the Mixpanel factory | ||
var Mixpanel = require('mixpanel'); | ||
```javascript | ||
// grab the Mixpanel factory | ||
var Mixpanel = require('mixpanel'); | ||
// create an instance of the mixpanel client | ||
var mixpanel = Mixpanel.init('6fd9434dba686db2d1ab66b4462a3a67'); | ||
// create an instance of the mixpanel client | ||
var mixpanel = Mixpanel.init('6fd9434dba686db2d1ab66b4462a3a67'); | ||
// track an event with optional properties | ||
mixpanel.track("my event", { | ||
distinct_id: "some unique client id", | ||
as: "many", | ||
properties: "as", | ||
you: "want" | ||
}); | ||
mixpanel.track("played_game"); | ||
// track an event with optional properties | ||
mixpanel.track("my event", { | ||
distinct_id: "some unique client id", | ||
as: "many", | ||
properties: "as", | ||
you: "want" | ||
}); | ||
mixpanel.track("played_game"); | ||
// create or update a user in Mixpanel Engage | ||
mixpanel.people.set("billybob", { | ||
$first_name: "Billy", | ||
$last_name: "Bob", | ||
$created: (new Date('jan 1 2013')).toISOString(), | ||
plan: "premium", | ||
games_played: 1, | ||
points: 0 | ||
}); | ||
// create or update a user in Mixpanel Engage | ||
mixpanel.people.set("billybob", { | ||
$first_name: "Billy", | ||
$last_name: "Bob", | ||
$created: (new Date('jan 1 2013')).toISOString(), | ||
plan: "premium", | ||
games_played: 1, | ||
points: 0 | ||
}); | ||
// set a single property on a user | ||
mixpanel.people.set("billybob", "plan", "free"); | ||
// set a single property on a user | ||
mixpanel.people.set("billybob", "plan", "free"); | ||
// increment a numeric property | ||
mixpanel.people.increment("billybob", "games_played"); | ||
// increment a numeric property | ||
mixpanel.people.increment("billybob", "games_played"); | ||
// increment a numeric property by a different amount | ||
mixpanel.people.increment("billybob", "points", 15); | ||
// increment a numeric property by a different amount | ||
mixpanel.people.increment("billybob", "points", 15); | ||
// increment multiple properties | ||
mixpanel.people.increment("billybob", {"points": 10, "games_played": 1}); | ||
// increment multiple properties | ||
mixpanel.people.increment("billybob", {"points": 10, "games_played": 1}); | ||
// append value to a list | ||
mixpanel.people.append("billybob", "awards", "Great Player"); | ||
// 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"}); | ||
// append multiple values to a list | ||
mixpanel.people.append("billybob", {"awards": "Great Player", "levels_finished": "Level 4"}); | ||
// record a transaction for revenue analytics | ||
mixpanel.people.track_charge("billybob", 39.99); | ||
// record a transaction for revenue analytics | ||
mixpanel.people.track_charge("billybob", 39.99); | ||
// clear a users transaction history | ||
mixpanel.people.clear_charges("billybob"); | ||
// clear a users transaction history | ||
mixpanel.people.clear_charges("billybob"); | ||
// delete a user | ||
mixpanel.people.delete_user("billybob"); | ||
// delete a user | ||
mixpanel.people.delete_user("billybob"); | ||
// all functions that send data to mixpanel take an optional | ||
// callback as the last argument | ||
mixpanel.track("test", function(err) { if (err) throw err; }); | ||
// Create an alias for an existing distinct id | ||
mixpanel.alias("distinct_id", "your_alias"); | ||
// import an old event | ||
var mixpanel_importer = Mixpanel.init('valid mixpanel token', { | ||
key: "valid api key for project" | ||
}); | ||
// all functions that send data to mixpanel take an optional | ||
// callback as the last argument | ||
mixpanel.track("test", function(err) { if (err) throw err; }); | ||
// needs to be in the system once for it to show up in the interface | ||
mixpanel_importer.track('old event', { gender: '' }); | ||
// import an old event | ||
var mixpanel_importer = Mixpanel.init('valid mixpanel token', { | ||
key: "valid api key for project" | ||
}); | ||
mixpanel_importer.import("old event", new Date(2012, 4, 20, 12, 34, 56), { | ||
distinct_id: 'billybob', | ||
gender: 'male' | ||
}); | ||
// needs to be in the system once for it to show up in the interface | ||
mixpanel_importer.track('old event', { gender: '' }); | ||
mixpanel_importer.import("old event", new Date(2012, 4, 20, 12, 34, 56), { | ||
distinct_id: 'billybob', | ||
gender: 'male' | ||
}); | ||
``` | ||
Tests | ||
@@ -112,2 +117,3 @@ ----- | ||
- [Zeevl](https://github.com/zeevl) | ||
- [Tobias Baunbæk](https://github.com/freeall) | ||
@@ -114,0 +120,0 @@ License |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
48048
123
3