Tracking Downloads with Google Analytics Dec 28, 2010

"How do I track non-HTML content (ZIP-files, images etc.) with Google Analytics?"

This question has been asked (and answered) a million times but I haven't found an answer for the new, asynchronous version of the Google Analytics code. So I had to figure this out myself:

<a href="setup.zip" onclick="_gaq.push(['_trackPageview', this.href]);">download</a>

Once again: if you're using the asynchronous version of the Google Analytics code that starts with "var _gaq = _gaq || [];", then use the code above. You're welcome :)

0 comments:

Post a Comment



Blog Archive