How to Track File Downloads in Google Analytics

Google Analytics Help So how do you track file downloads in Google Analytics? 

It is actually easier than you might think.  If you want to track files (like .zip, .pdf, .mp3 or anything else) and see how many times they have been downloaded, you must use the correct corresponding JavaScript code.  As mentioned by Google (if you search the help documents deeply enough) 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.

For example, if you wanted to track every time somebody downloaded your eBook .pdf file, that was stored at www.yourdomain.com/files/ebook.pdf you would need to add the following to the <a> tag:

<a href=http://www.yourdomain.com/files/ebook.pdf onClick="javascript: pageTracker._trackPageview(’/downloads/ebook’); ">

If that doesn’t do it for you, you might need to update your tracking code, or check here for how to do this with the older tracking code.  24 to 48 hours later, you should see your files in question being tracked.  You download count (using the example above) would show up as /downloads/ebook.

As a bonus for people using WordPress, you can do this automatically with the Ultimate Google Analytics plugin.  Hope that helps those of you using Google Analytics to track your latest web site statistics!

Post to Twitter Post to Delicious Post to Facebook Post to StumbleUpon

Related Tips and Tricks:

Comments are closed.