Skip to content

A jQuery plugin that supports declarative event tracking in Google Analytics

License

Notifications You must be signed in to change notification settings

abrudtkuhl/jQuery-Google-Analytics

Repository files navigation

jQuery Analytics

jQuery.analytics is an Google Analytics jQuery plugin that is easy to implement and allows for declarative tagging to track events and pageviews.

  • Track Page Views
  • Track Click Events with easy declartive syntax

Getting Started

Download the production version or the development version.

Usage

  1. Include jQuery version 1.4.3 or later

  2. Include jquery.analytics.js script

  3. Initialize the plugin

    $(document).ready() {
        $(document).analytics();
    };
    
  4. Add declarative data attributes to things you want to track events on <button data-track='{ "category" : "search", "action" : "button", "label" : "Search" }'>Search</button>

Testing

I recommend the excellent Google Analytics Debugger Chrome extension to test what gets tracked via Google Analytics.

Dependencies

jQuery version 1.4.3 - see data() support

Google Analytics Support

As of 2/9/14 this jQuery plugin supports both versions of Google Analytics

analytics.js
Supports Google's latest version of Universal Analytics script called analytics.js which uses the "ga" object.

ga.js
This is the older version of Google Analytics tracking that uses the asynchronous syntax.

Author

Andy Brudtkuhl
@abrudtkuhl

Release History

(Nothing yet)

About

A jQuery plugin that supports declarative event tracking in Google Analytics

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published