Track File Downloads & Outbound Exit Links Automatically

What this Google Analytics Plugin does

Automatic tracking of file downloads and outbound exit links links in Google Analytics – without the pain of modifying each link manually across your site. Aimed at webmasters, this JavaScript plugin scans all your page links for you in the background, and automatically adjusts them accordingly for Google Analytics by automatically adding an onClick event handler for you. There is also the option to modify the bounce rate calculation. Read the blog post. Summary of features:

  • Massive time saver – Automatic tracking. No manual modifications of your exit links required, just drop this script into your page header
  • Automatically track File downloads – MS Office (doc/x, xls/x, ppt/x), exe, zip, txt, pdf
  • Automatically track all mailto: links
  • Automatically track outbound exit links i.e. those not local to yourdomain.com
  • Flexible – For each type (download link, outbound link, exit link, mailto link), select if these are tracked as a virtual pageview or an event
  • Multiple pageTracker support – works with multiple page tags. See the post Roll-up reporting in Google Analytics for when this is useful
  • Improve bounce rate calculation – You can optionally set a timeout to redefine a bounced visit e.g. treat a single page visit as a bounce if time on page = 30+ seconds
  • Completely self-contained and independent of all other libraries, such as jquery

As you may know, I wrote the original file download and outbound link tracking script back in 2007. Things have moved on since then. This Plugin has been completely rewritten for the ga.js async code, with more flexibility, better performance and improved browser compatibility.

Also try this with the Customising the SEO list for Google Analytics plugin.

Usage

  • For use with ga.js (async) only.
  • The code is regularly updated. All subscribers will be notified of updates via email.
  • Last code update: April-2012

Easy Install

  1. Purchase either the Standard or the Developer version of the automatic plugin to receive the JavaScript file.
  2. Upload the .js file into your website root directory (used in this example) or other suitable place
  3. Modify all your web pages (once only change) to reference the .js file above your Google Analytics Tracking Code.
  4. That’s it… Or perhaps you thought there was more!

Example GATC – the only line added is #1. The rest is your remaining tracking code:

[js]

[/js]

You can view the new GA calls in your Real-Time reports, or by using the the GA Debugger extension for Chrome (see item #4 of my post The Best Google Analytics Addons).

In your standard reports, allow approx. 4 hours for your reports to be populated with the new information. To view these, log in to your Google Analytics account and goto ‘Content > Site Content > All Pages’ report (for virtual pageviews – see below image), or ‘Content > Site Content > Events > Top Events’ report (if you have configured it for event tracking).

For virtual pageviews, the data is shown in the Content/Site Content/All Pages report

If you are combining this with the Custom Search Engine Hack, your GATC will look like the following (lines #1,2 and 7 are the changes):




Who uses this…?

Small businesses, universities and blue-chip clients rely on this plugin…

clients using the Google Analytics plugins

Feedback

As always, I appreciate feedback. Feel free to suggest new features. Also, check out the Custom Search Engine list for Google Analytics plugin.