-
Notifications
You must be signed in to change notification settings - Fork 1
/
gaat-1.2.min.js
1 lines (1 loc) · 1.72 KB
/
gaat-1.2.min.js
1
(function(a){a.gaat=function(b){function c(a){if(typeof _gaq=="object"){_gaq.push(["_trackPageview",a]);return true}if(typeof pageTracker=="object"){pageTracker._trackPageview(a);return true}}function d(d,e){if(b.debug)d.preventDefault();var f=a(e).attr("href");var g=b.email+f.substring(7);if(b.debug)alert(g);c(g)}function e(d,e){if(b.debug)d.preventDefault();var f=a(e).prop("pathname");var g=a(e).prop("search");var h=f.charAt(0)=="/"?f:"/"+f;if(g&&f.indexOf(g)==-1)h+=g;h=b.download+f.split(".").pop()+h;if(b.debug)alert(h);c(h)}function f(d,e){if(b.debug)d.preventDefault();var f=a(e).prop("pathname");var g=a(e).prop("hostname");var h=a(e).prop("search");var i=f.charAt(0)=="/"?f:"/"+f;if(h&&f.indexOf(h)==-1)i+=h;i=b.external+g+i;if(b.debug)alert(i);c(i)}function g(){a("a").each(function(){try{var c=a(this).prop("href");var g=a(this).prop("hostname");var h=a(this).prop("protocol");var i=a(this).prop("pathname");var j=a(this).prop("search");var k=i+j;if(h=="mailto:"){a(this).click(function(a){d(a,this)})}else if(g==b.hostname&&k.match(b.extensions)){a(this).click(function(a){e(a,this)})}else if(g!=b.hostname&&!c.match(/^javascript:/)){a(this).click(function(a){f(a,this)})}}catch(l){}})}b=a.extend({extensions:["doc","eps","svg","xls","ppt","pdf","xls","zip","txt","vsd","vxd","js","css","rar","exe","wma","mov","avi","wmv","mp3"],email:"/email/",external:"/external/",download:"/tracked/",hostname:location.host,debug:false},b);b.extensions=new RegExp("\\.(?:"+b.extensions.join("|")+")($|\\&|\\?)");if(!a.fn.prop){a.fn.extend({prop:function(b){return a(this).attr(b)}})}if(typeof pageTracker=="object"||typeof _gaq=="object"){g()}else{if(b.debug)alert("Unable to initialise GAAT, missing Google Analytics pageTracker");g();return false}}})(jQuery)