Skip to content

britg/sammy-google-analytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A Sammy.js plugin for tracking route changes in Google Analytics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published