The following post outlines one method for achieving automatic download and outbound link tracking for Google Analytics.
Although manually tagging files and links is the best way to track your downloads and outbound links, it is not very practical. Tagging more than a handful of links becomes painful.
Okay, so what are the downsides to automatic tracking?
- If you have many, many files or links on a page it is going to take time for the script to run through your page and apply the tags to each file or link.
- Place the following code above your Google Analytics Tracking Code:
This script only works for the ga.js Google Analytics Tracking Code, if you are still using urchin.js you will need to update this first.
This script was originally developed by Goodwebpractices.com with the help of ShoreTel, MerryMan and Colm McBarron. Our version has had some slight modification from VKI Studios and ourselves, Mangold Sengers.
Your Google Analytics Tracking Code should now look something like this:
Check your Google Analytics reports in 12 to 24 hours to ensure that file downloads and outbound links are tracking correctly. You should see your downloads and links being tracked into the Top Content and Content Drilldown reports e.g. /downloads/path-to-file/file.pdf and /outbound/www.externalsite.com/index.html