Track Downloads and Other Click Events in Analytics with jQuery
A great rundown by Rob Flaherty on how to Track Downloads and Other Click Events in Analytics with jQuery:
The old way to track clicks and outbound links in Google Analytics was to call the _trackPageview function on the click event, passing it a label that could then be searched for in Analytics. One of the problems with this method was that the clicks were counted as pageviews, affecting your total pageview number.
Now Analytics offers an event tracking feature. It can be used to track downloads, outbound links, mailto links, AJAX events—any click event. But the event tracking function still has to be implemented for each event you want to track. Here’s some jQuery that handles the implementation for you.
Google Analytics event tracking isn’t all that new, but I haven’t seen many articles written about integration with jQuery. There are several jQuery plugins that already do this (e.g., here and here), but Flaherty’s article gives a good high-level view of how to do this without using a plugin while defining things like event category and event label in an automated way based on the type of link that’s being tracked.
Find This Article Useful?
Related Articles
About this entry
You’re currently reading “Track Downloads and Other Click Events in Analytics with jQuery,” an entry on MirthLab
- Published:
- Monday, December 14th, 2009 at 12:00 pm
- Author:
- Mark Quezada
- Category:
- Links, Web Development
- Tags:
- google analytics, jquery, tracking

No comments
Jump to comment form | comments rss | trackback uri