How can I enable Google Analytics on a file download link?

You basically have to tag the <a> link

Google Analytics provides an easy way
to track clicks on links that lead to
file downloads.

Because these links do
not lead to a page on your site
containing the tracking code, you’ll
need to tag the link itself with the
_trackPageview() JavaScript if you would like to track these downloads.
This piece of JavaScript assigns a
pageview to any click on a link – the
pageview is attributed to the filename
you specify.

For example, to log every click on a
particular link to
www.example.com/files/map.pdf as a
pageview for /downloads/map you would
add the following attribute to the
link’s tag:

<a href="http://www.example.com/files/map.pdf" onClick="javascript: pageTracker._trackPageview('/downloads/map'); ">

http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55529

Hope that helps 🙂

Leave a Comment