Home > sammy-mixpanel

sammy-mixpanel

Sammy-mixpanel is a project mainly written in JavaScript, it's free.

A Sammy.js plugin for tracking route changes in Mixpanel

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!

  • Intro
  • Docs
  • Examples
  • More Resources

Keep informed!

  • Follow @sammy_js
  • Join the mailing list
  • Chat with us in #sammy

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).

Previous:PTE-DNA