Tracking file downloads or clicks on external links behavior is very important to analyze if people are interacting with the website the way intended. For example, businesses that have their brochures or product catalogs downloadable as PDFs can see if their publications are in demand and what the best way is to position the file links on the website to increase the clickthrough rate.
The official Google Analytics tutorial says that any link can be tracked if the script below is added in each link that you'd like to track:
If you already have lots of pdfs, docs or other files that need to be tracked, adding the aforementioned script to every download link on your website can be a very tedious task. So we will present a much simpler way to track file downloads and clicks on external links. Here we go:
- Download Google Analytics file download tracking script and upload it to your web site (add it to this folder: http://www.yoursite.com/scripts/ )
Note: This tracker is written for Google Analytics new tracking code which uses ga.js. If you are using the old tracking code with urchin.js, you should not use the method described above to track your file downloads. The script also detects whether you open the file in a new window (_blank) or not and then automatically uses setTimeout() for 200ms if you are not. If you have multiple tracking objects on a page or have a named tracker, we recommend to customize the script to suit your needs.
You can also check out the SEO Book's tutorial on how to track events (file downloads, clicks, etc) in the new Google Analytics.
Oleksiy is the Founder of ArtDriver. He oftentimes takes the lead as the Agile Project Manager and SEO expert on selected projects, which allows him to be hands-on with the latest trends. In his spare time, Oleksiy enjoys playing the guitar and spending time with his family.