Skip to content

Latest commit

 

History

History
66 lines (39 loc) · 1.94 KB

README.md

File metadata and controls

66 lines (39 loc) · 1.94 KB

Sammy.js Google Analytics Plugin

Description

A small plugin that enables Google Analytics tracking for your Sammy powered App.

Installation

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

Usage

Install Google Analytics to your site as you normally would. Be sure that the 'pageTracker' global variable exists.

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

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

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

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

Example

http://britg.github.com/sammy-google-analytics

Dependencies

Sammy http://code.quirkey.com/sammy

Sammy requires jQuery >= 1.3.2 Get it from: http://jquery.com

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