jQuery Plugin: Outbound Analytics
July 22, 2012A jQuery plugin aimed at making it easier to track outbound (external) links with Google Analytics.
Getting Started
Download the production version or the development version.
99% of the time you’ll probably just want to track clicks on all outbound links on a page. This is easy. In your web page:
Sometimes you may want to track only certain links, or track links in your header or footer different. This is easy, too. In your web page:
Fully Customizable
The plugin comes with smart defaults and everything you pass to Google Analytics is totally customizable (options can even be passed as functions). Here’s what you have access to:
Name | Type | Default | Description |
---|---|---|---|
category | String | Outbound Links | The category used in Google Analytics |
action | String | Click | The action used in Google Analytics |
label | String | The link’s href attribute | The label used in Google Analytics |
value | Float | null | The value assigned to the event in Google Analytics |
nonInteraction | Boolean | false | Whether or not the event calculates into the bounce rate in Google Analytics |
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.
Also, please don’t edit files in the “dist” subdirectory as they are generated via grunt. You’ll find source code in the “src” subdirectory!
Release History
- 0.1.1: Improving external link detection.
- 0.1.0: Intial release.