Skip to content
A Sammy.js plugin for tracking route changes in Mixpanel
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
README.md
sammy.mixpanel.js

README.md

Sammy.js Mixpanel Plugin

Description

A small plugin that enables Mixpanel tracking for your Sammy powered App. Following the footsteps of the great Sammy Google Analytics Plugin.

Installation

Download sammy.mixpanel.js and install it in your public javascripts directory. Include it in your document AFTER Sammy.

Usage

Install Mixpanel to your site as you normally would. Modify the Mixpanel script:

... d=["init","track","track_links","track_forms","track_pageview","register","register_once","identify","name_tag","set_config"]; ...
                                                  ^ add this!

Then, simply add the plugin to your Sammy App and it will automatically track all of your routes in Mixpanel. They will appear as page views to the route's path.

$.sammy(function() { with(this) {
  use(Sammy.Mixpanel)
  
  ...
}});

If you have routes that you do not want to track, simply call "noTrack" within the route.

$.sammy(function() { with(this) {
  use(Sammy.Mixpanel)
  
  get('#/dont/track/me', function() {
    this.noTrack();  // This route will not be tracked
  });
}});

Example

http://hleinone.github.com/sammy-mixpanel

Dependencies

Sammy

Sammy requires jQuery >= 1.3.2

More!

Learn!

Keep informed!

License

Sammy is covered by the MIT License. See LICENSE for more information.

Sammy includes code originally created by John Resig (Class implementation) and Greg Borenstien (srender).

You can’t perform that action at this time.