Skip to content
This repository has been archived by the owner on Jul 25, 2021. It is now read-only.

percolatestudio/meteor-mixpanel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Light Mixpanel Loader package for Meteor.

Loading fragment is copied almost verbatim from mixpanel except initialization is done manual.

Usage

The window.mixpanel object is available for use as per normal.

First, initialize and reactively setup the user such as:

Meteor.startup(function() {
  // Initialize Mixpanel Analytics
  mixpanel.init(Meteor.settings.public.mixpanel.token); //YOUR TOKEN

  // Link their account
  Deps.autorun(function() {
    var user = Meteor.user();

    if (! user)
      return;

    mixpanel.identify(user._id);
    mixpanel.people.set({
        "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 //IF YOU HAVE IT
    });
  });
});

License

MIT. (c) Percolate Studio, maintained by Zoltan Olah (@zol).

About

Light Mixpanel Loader package for Meteor.

Resources

Stars

Watchers

Forks

Packages

No packages published