jQuery Google Analytics Tracking API Integration (ga.js)

March 26th, 2008

Jason Huck’s gaTracker jQuery plugin allows for unobtrusive integration of the Google Analytics tracker into a page as well as attaching tracking events to each external link, mailto and download. It works seamlessly but it does however currently use the old ‘urchin.js’ which has been superceeded by Google’s new Tracking API (ga.js)

ga.js has all the capabilities of urchin.js but is structured in a fully Object oriented way. The new API has some nice new functionality which among other things allows for tracking of e-commerce transactions, which is pretty exciting. If you like that sorta thing.

I’ve quickly modified gaTracker to utilise the new API and call it’s _trackPageview() method rather than using urchinTracker(). The code is available below:

jquery.gatracker.js (Tracking API version)

It works in exactly the same way as the gaTracker 1.0.1 release, and can be dropped in it’s place, but utilises the new tracking API. Feel free to grab a copy until support gets built into the official release.

Posted in Web | Tagged with: ,

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.