Skip to content


Subversion checkout URL

You can clone with
Download ZIP
tree: 23d7de4fc1
Fetching contributors…

Cannot retrieve contributors at this time

104 lines (76 sloc) 2.913 kb


Build Status

This library provides many of the features in the official javascript mixpanel library. It is easy to use, and fully async.


npm install mixpanel

Quick Start

// grab the Mixpanel factory
var Mixpanel = require('mixpanel');

// 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"

// 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");

// 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 multiple properties
mixpanel.people.increment("billybob", {"points": 10, "games_played": 1});

// record a transaction for revenue analytics
mixpanel.people.track_charge("billybob", 39.99);

// clear a users transaction history

// delete a user

// all functions that send data to mixpanel take an optional
// callback as the last argument
mixpanel.track("test", function(err) { if (err) throw err; });

// import an old event
var mixpanel_importer = Mixpanel.init('valid mixpanel token', {
    key: "valid api key for project"

// 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'


# in the mixpanel directory
npm install
npm test


Heavily inspired by the original js library copyright Mixpanel, Inc. (

Copyright (c) 2012 Carl Sverre

Contributions from:


Released under the MIT license. See file called LICENSE for more details.

Jump to Line
Something went wrong with that request. Please try again.