/******************************************************************************
  Author & Copyright: Brian J Clifton
  Url: http://www.advanced-web-metrics.com/blog/auto-tracking-file-downloads-outbound-links/

  This script is NOT free to use

  Hack for Google Analytics to auto-track: 
   external links - tracked as /outbound/url-of-external-site
   file downloads - tracked as /downloads/filename
   mailto:        - tracked as /mailto/email-address-clicked
   PLUS: option Event trigger so that single page visits of 30+ seconds are not treated as bounces

  VERSION:
  v1.10, 13-June-2011

  USAGE:
  For use with ga.js(async) only. You need to do 3 straightforward things for this to work:
  1. Install this script in your website root directory and reference it in your GATC
      - as decribed at http://www.advanced-web-metrics.com/blog/auto-tracking-file-downloads-outbound-links/
  2. Replace the domain listed on line 49 (shown as YOUR-DOMAIN.COM) to your website domain
     - only use your main domain. Do not include a subdomain e.g. www., shop., secure., - unless you specifically
       wish to restrict the operation of this script to a subdomain only
  3. Scroll down and modify the function addLinkerEvents to meet your requirements:
     function init(){ addLinkerEvents(a,b,c,bounceTime,localDomains));} ;
  
     where:
     a = 1 or 0, use Event Tracking for external links (1), or use virtual Pageview tracking (0)
     b = 1 or 0, use Event Tracking for file downloads (1), or use virtual Pageview tracking (0)
     c = 1 or 0, use Event Tracking for mailto links (1), or use virtual Pageview tracking (0)
     bounceTime = 30 seconds, uses Event Tracking for single page visits >30 secs, or do not modify (0)
		tracked as event category "Non-bounced", action "30 secs"
		any other value will be treated as 30 seconds
     localDomains = your web domain e.g. your-domain.com
		do not specify a subdomain unless you only wish to include this

  DISCLAIMER:
  All scripts presented have been tested and validated by the author and are
  believed to be correct as of the date of publication or posting. The Google
  Analytics software on which they depend is subject to change, however; and
  therefore no warranty is expressed or implied that they will work as
  described in the future. Always check the most current Google Analytics
  documentation.

  UPDATES:
  v 1.10
  - fixed 'timeout' undefined error that was stopping the bouncr rate modifier working correctly
  - added a catch for bookmarked links to be ignored - previously logged as 'undefined' 

******************************************************************************/
/*
 * Thanks to Nick Mikailovski (Google) for initial discussions and Tomas Remotigue for additional development.
 * trackEvents - true uses event tracking, false uses virtual page views 
*/

var _0x4bbc=["\x67\x6F\x6F\x67\x6C\x65\x2D\x61\x6E\x61\x6C\x79\x74\x69\x63\x73\x2E\x63\x6F\x6D","heacademy.ac.uk","\x6F\x6E\x6C\x6F\x61\x64","\x2E\x64\x6F\x63","\x2E\x78\x6C\x73","\x2E\x70\x70\x74","\x2E\x65\x78\x65","\x2E\x7A\x69\x70","\x2E\x74\x78\x74","\x2E\x70\x64\x66","\x20\x73\x65\x63\x73","\x5F\x67\x61\x71\x2E\x70\x75\x73\x68\x28\x5B\x27\x5F\x74\x72\x61\x63\x6B\x45\x76\x65\x6E\x74\x27\x2C\x20\x27\x4E\x6F\x6E\x2D\x62\x6F\x75\x6E\x63\x65\x64\x27\x2C\x20\x6E\x65\x77\x74\x69\x6D\x65\x6F\x75\x74\x5D\x29\x3B","\x61","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x73\x42\x79\x54\x61\x67\x4E\x61\x6D\x65","\x6C\x65\x6E\x67\x74\x68","\x6E\x61\x6D\x65","\x67\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x6F\x6E\x63\x6C\x69\x63\x6B","\x75\x72\x63\x68\x69\x6E\x54\x72\x61\x63\x6B\x65\x72","\x69\x6E\x64\x65\x78\x4F\x66","\x5F\x74\x72\x61\x63\x6B\x50\x61\x67\x65\x76\x69\x65\x77","\x6D\x61\x69\x6C\x74\x6F\x3A","\x68\x72\x65\x66","\x3A","\x73\x70\x6C\x69\x74","\x6D\x61\x69\x6C\x74\x6F","\x73\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x2F\x2F","\x6F\x75\x74\x62\x6F\x75\x6E\x64","\x64\x6F\x6D\x61\x69\x6E","\x2F","\x64\x6F\x77\x6E\x6C\x6F\x61\x64\x73","\x3B","","\x5F\x67\x61\x71\x2E\x70\x75\x73\x68\x28\x5B","\x27\x5F\x74\x72\x61\x63\x6B\x45\x76\x65\x6E\x74\x27\x2C\x27","\x27\x2C\x27\x43\x6C\x69\x63\x6B\x27\x2C\x27","\x27","\x27\x5F\x74\x72\x61\x63\x6B\x50\x61\x67\x65\x76\x69\x65\x77\x27\x2C\x27\x2F","\x5D\x29\x3B\x20"];var localDomains=[_0x4bbc[0],_0x4bbc[1]];

function init(){addLinkerEvents(1,1,1,30,localDomains);} ;
// set the above line according to the instructions above. In this example, only mailto links are tracked as an Event
// file downloads and outbound links tracked as virtual pageviews. The bounce rate calculation is modified to 30 secs.

window[_0x4bbc[2]]=init;var newtimeout;function addLinkerEvents(_0x7adfx5,_0x7adfx6,_0x7adfx7,_0x7adfx8,_0x7adfx9){var _0x7adfxa=[_0x4bbc[3],_0x4bbc[4],_0x4bbc[5],_0x4bbc[6],_0x4bbc[7],_0x4bbc[8],_0x4bbc[9]];if(_0x7adfx8!=30&&_0x7adfx8!=0){_0x7adfx8=30;} ;if(_0x7adfx8!=0){milliTimeout=_0x7adfx8*1000;newtimeout=_0x7adfx8+_0x4bbc[10];setTimeout(_0x4bbc[11],milliTimeout);} ;var _0x7adfxb=document[_0x4bbc[13]](_0x4bbc[12]);for(var _0x7adfxc=0;_0x7adfxc<_0x7adfxb[_0x4bbc[14]];_0x7adfxc++){var _0x7adfxd=_0x7adfxb[_0x7adfxc][_0x4bbc[16]](_0x4bbc[15]);if(_0x7adfxd!=null){continue ;} ;var _0x7adfxe=_0x7adfxb[_0x7adfxc][_0x4bbc[16]](_0x4bbc[17]);if(_0x7adfxe!=null){_0x7adfxe=String(_0x7adfxe);if(_0x7adfxe[_0x4bbc[19]](_0x4bbc[18])>-1||_0x7adfxe[_0x4bbc[19]](_0x4bbc[20])>-1){continue ;} ;} ;if(_0x7adfxb[_0x7adfxc][_0x4bbc[22]][_0x4bbc[19]](_0x4bbc[21])!=-1){var _0x7adfxf=_0x7adfxb[_0x7adfxc][_0x4bbc[22]][_0x4bbc[24]](_0x4bbc[23]);_0x7adfxb[_0x7adfxc][_0x4bbc[26]](_0x4bbc[17],getAsync(_0x7adfx7,_0x4bbc[25],_0x7adfxf[1],_0x7adfxe));} else {var _0x7adfx10=true;for(var _0x7adfx11=0;_0x7adfx11<_0x7adfx9[_0x4bbc[14]];_0x7adfx11++){if(_0x7adfxb[_0x7adfxc][_0x4bbc[22]][_0x4bbc[19]](_0x7adfx9[_0x7adfx11])>=0){_0x7adfx10=false;} ;} ;if(_0x7adfx10){var _0x7adfxf=_0x7adfxb[_0x7adfxc][_0x4bbc[22]][_0x4bbc[24]](_0x4bbc[27]);_0x7adfxb[_0x7adfxc][_0x4bbc[26]](_0x4bbc[17],getAsync(_0x7adfx5,_0x4bbc[28],_0x7adfxf[1],_0x7adfxe));} else {for(var _0x7adfx12=0;_0x7adfx12<_0x7adfxa[_0x4bbc[14]];_0x7adfx12++){if(_0x7adfxb[_0x7adfxc][_0x4bbc[22]][_0x4bbc[19]](_0x7adfxa[_0x7adfx12])!=-1){var _0x7adfxf=_0x7adfxb[_0x7adfxc][_0x4bbc[22]][_0x4bbc[24]](document[_0x4bbc[29]]+_0x4bbc[30]);_0x7adfxb[_0x7adfxc][_0x4bbc[26]](_0x4bbc[17],getAsync(_0x7adfx6,_0x4bbc[31],_0x7adfxf[1],_0x7adfxe));break ;} ;} ;} ;} ;} ;} ;function getAsync(_0x7adfx14,_0x7adfx15,_0x7adfx16,_0x7adfx17){var _0x7adfx18=(_0x7adfx17!=null)?_0x7adfx17+_0x4bbc[32]:_0x4bbc[33];var _0x7adfx19=_0x4bbc[34];var _0x7adfx1a=_0x4bbc[33];if(_0x7adfx14){_0x7adfx1a=_0x4bbc[35]+_0x7adfx15+_0x4bbc[36]+_0x7adfx16+_0x4bbc[37];} else {_0x7adfx1a=_0x4bbc[38]+_0x7adfx15+_0x4bbc[30]+_0x7adfx16+_0x4bbc[37];} ;var _0x7adfx1b=_0x4bbc[39];return _0x7adfx19+_0x7adfx1a+_0x7adfx1b+_0x7adfx18;} ;
