What this Google Analytics Plugin does

Automatic tracking of file downloads and outbound links links in Google Analytics - without the pain of modifying each link 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 adding an onClick event handler. 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 links required, just drop this script into your page header
  • Auto-track File downloads – MS Office (doc/x, xls/x, ppt/x), exe, zip, txt, pdf
  • Auto-track all mailto: links
  • Auto-track outbound links i.e. those not local to yourdomain.com
  • Flexible – For each type (download, outbound, mailto), 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

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.

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-2011
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:

<script type="text/javascript" src="/addLinkerEvents-std.js"></script><script type="text/javascript">// <![CDATA[
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-123456-1']);
  _gaq.push(['_trackPageview']);
 
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
// ]]></script>

Allow at least 4 hours for your reports to be populated with the new information. To view these. Log in to your Google Analytics account, select   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):

<script type="text/javascript" src="/addLinkerEvents-std.js"></script><script type="text/javascript" src="/custom_se-async.js"></script><script type="text/javascript">// <![CDATA[
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-123456-1']);
 
  addCustomOrganic(_gaq); 		// custom search engines
  _gaq.push(['_trackPageview']);
 
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
// ]]></script>

Updates By subscribing to this hack you will be notified when the code is updated. Then all you need to do is replace your .js file with the new one. No page or GATC changes required. Feedback As always, I appreciate feedback. Also, feel free to suggest new features. Also, check out the Custom Search Engine list for Google Analytics plugin.