Google Analytics Made Spiffy with jQuery
By Dia • Aug 5th, 2008 • Category: CodeJason Huck makes Google Analytics even easier to implement thanks to jQuery.
Currently the plugin does the following:
- Determine whether to include the SSL or non-SSL version of the GA script.
- Include the GA script from within try/catch to help suppress any issues GA may have from time to time.
- Set the _uacct variable to your GA tracking code.
- Call the urchinTracker() function once for the initial page load.
- Examine all of the links on the page and attach onclick events to:
- External links.
- Mailto links.
- Downloads.
- Call urchinTracker() when these links are clicked, prefixing them appropriately.
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.
If you’ve ever seen an old school omniture implementation the simplicity of the gaTracker plugin might make you want to hug Jason Huck and John Resig. Just a warning.
Recently I’ve had to work without jQuery’s impressive DOM traversal because of fears of scalability on a certain platform. If you have a TON of other scripts (dot DOT .NET) running at all times anything happening after the DOM finally loads could seem like the straw that broke the camels back, and I do understand, really I do. There have been recent strides to easily integrate jQuery into .NET and shops that push for it will definitely reap the benefits.
A lot of Ajax functionality in .NET is old school and bloated. I have a link courtesy of @jQuery that I’ll hunt down and add to this post tomorrow when I get back to the dungeon.. errhhh I mean work.
Dia is a working web developer/designer who loves learning new things and sharing that with people
Email this author | All posts by Dia


[...] My big win for today was finding the gaTracker plugin. [...]