Ever wanted to know how many times a PDF was downloaded from your website? Or maybe you need to track now many people watch your company video. Whatever the case, there’s an easy way with Google Analytics.
Here’s how it’s done. Let’s say you have a page with a link to a .pdf document. The html link would look something like this:
<a href=”http://www.example.com/subdirectory/document.pdf”>Download PDF</a>
In order to make it so Google Analytics can track this PDF and post the results in the Top Content section of analytics, all you need to do is replace the sample url above with the following:
<a href=”http://www.example.com/subdirectory/document.pdf” onClick=”javascript: pageTracker._trackPageview(’/subdirectory/sample_document_name’); “>Download PDF</a>
Now, lets say that you have downloads all over your website and you need to track each one. Well, you still need to use the above code as the html link, but in order to make it easier to track each of these in the Top Content section, you’ll want to make it appear as if each download is located in the same folder – see below:
- (’/downloads/sample_document_title’)
Notice that I replaced the actual location /subdirectory/ with /downloads/ – this makes it easy when looking through Google Analytics to find everything that was downloaded, even if the files are actually in different directories or sub directories.
I actually just finished setting this up for a client that has roughly 30 downloads to track. They have white papers, power points and other such media that is physically located in different folders with no standard naming convention.
In order to make it easier for them to find what content had been downloaded, I used the following structure:
- (’/downloads/catalogs/sample_catalog_name’)
- (’/downloads/whitepapers/sample_whitepaper_name’)
- (’/downloads/ppt/sample_ppt_name’)
Now, when myself or the client goes into Google Analytics, we don’t have to remember every directory or sub directory that may have had a downloadable item – in the traffic stats, they all appear as if they are in the /downloads/ folder. So, a simple ascending or descending sort aligns all /downloads folders so they are easy to see.
