Client wrapper for MixPanel with optional user tracking
Switch branches/tags
Nothing to show
Clone or download
Latest commit 4285601 Feb 26, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.npm/package Added NPM packge Apr 8, 2015
client fix ref error Feb 8, 2016
server Mixpanel on client and server Apr 29, 2015
.versions fix ref error Feb 8, 2016
README.md Update README.md Feb 26, 2016
mixpanel-tests.js initial commit Apr 8, 2015
package.js fix ref error Feb 8, 2016

README.md

Meteor Mixpanel

Client and Server wrapper for MixPanel with optional user tracking

Quick Start

  1. meteor add yogiben:mixpanel
  2. Include your token in the public object in your settings.json.
{
  "public": {
    "mixpanel": {
      "token": "18c8346c615ee36b40d3d5c267285ad0"
    }
  }
}
  1. mixpanel.track('purchase, {productId: 1})

Easy Tracking of users on the client

MixPanel lets you track users.

Add this somewhere in your code e.g. /client/lib/

// This is an example.

// Client
Meteor.startup(function() {
  Tracker.autorun(function() {
    var user = Meteor.user();
    if (!user) return;
    mixpanel.identify(user._id);

    person = {
      "Name": user.profile.firstName + ' ' + user.profile.lastName,

      // special mixpanel property names
      "$first_name": user.profile.firstName,
      "$last_name": user.profile.lastName,
      "$email": user.emails[0].address,
      "$created": user.createdAt.toISOString()
    }

    mixpanel.people.set(person);
  });
};

Mixpanel on the server

Biggest difference to client API is associated events with users. See the api for more details.