This plugin is intended to simplify the process of adding Google Analytics tracking to a page, including the tracking of outbound links, mailtos, and downloads, which are not otherwise tracked by default. Calling the plugin does the following:
In addition to the tracking code, the prefixes used for each of the link types above, as well as the extensions considered “downloadable files” are configurable by the user.
It requires jQuery 1.2 or higher for the cross-domain $.getScript() call. Usage is simply:
$.gaTracker('UA-XXXXX-XX');
Or you can specify options like so:
$.gaTracker( 'UA-XXXXX-XX', { external: '/external/', [mailto: ](mailto: "mailto: ") '/mailto/', download: '/downloads/', extensions: [ 'pdf','doc','xls','csv','jpg','gif', 'mp3', 'swf','txt','ppt','zip','gz','dmg','xml' ] } );