How Many File Downloads is Google Analytics Tracking For You?

Google Analytics provides valuable information about your visitor traffic and what visitors find interesting on your website or blog pages. However, it does not track file downloads by default.


What if you have eight downloadable files and you want to know which of the eight is downloaded the most?

The easy option is to use the Site Overlay feature. However, I found, on a low traffic site, that it did not record clicks on file download links. Please let me know if you find otherwise.

Google provides another option, adding a javascript tracking code to each file download link. This bit of javascript assigns a pageview to the clicks on your file links which Google easily tracks.

Adding the Google Analytics code to your links

a href=”folder-name/file-name.pdf”
onClick=”javascript: pageTracker._trackPageview(‘folder-name/file-name.pdf’);”>
This is a complete code sample

a href=”folder-name/file-name.pdf”
This line is the path to your pdf. I didn’t need to change anything here.

onClick=”javascript: pageTracker._trackPageview(‘folder-name/file-name.pdf’);”>
This line is the tracker code. This is the new Google code that was added.

onClick=”javascript: pageTracker._trackPageview(‘folder-name/fn.pdf’
The file-name.pdf in this line can be any text that you choose. Here it is shortened to fn.pdf.

Bonus: Try a shorter link name

I shortened the file name text compared to the acutal file name so that it would fit nicely in the Google Analytics display.

  • Simple cut and paste
  • Consider shortening the file name
  • Works with any kind of downloadable file, pdf, avi, doc and so on.

Give it a try

Don’t expect to see the results immediately. Google suggests waiting one or two days. I saw results within 30 minutes.

Here is a link to the Google Analytics Help page.

You are invited to share your comments below. Thanks for visiting.

2 thoughts on “How Many File Downloads is Google Analytics Tracking For You?”

  1. Thanks Jim. Your thinking is much like mine when it comes to the value of social media. You can’t ignore the bottom line, but at the same time social media relationships just like offline relationships often take a while to build and don’t usually “convert” on the first contact.

Comments are closed.