Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
42ed949a36
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
31 lines (26 sloc) 1.52 KB
/* Attach tracking to all download & external links */
var _gaq = _gaq || [];
function _gaLt(event){
var el = event.srcElement || event.target;
/* Loop up the tree through parent elements if clicked element is not a link (eg: an image in a link) */
while(el && (typeof el.tagName == 'undefined' || el.tagName.toLowerCase() != 'a' || !el.href))
el = el.parentNode;
if(el && el.href){
if(el.href.indexOf(location.host) == -1 && el.getAttribute('data-toggle') != 'dropdown'){ /* external link */
_gaq.push(["_trackEvent", "Outgoing Links", el.href, document.location.pathname + document.location.search]);
_gaq.push(["b._trackEvent", "Outgoing Links", el.href, document.location.pathname + document.location.search]);
/* if target not set then delay opening of window by 0.5s to allow tracking */
if(!el.target || el.target.match(/^_(self|parent|top)$/i)){
setTimeout(function(){
document.location.href = el.href;
}.bind(el),500);
/* Prevent standard click */
event.preventDefault ? event.preventDefault() : event.returnValue = !1;
}
}
}
}
/* Attach the event to all clicks in the document after page has loaded */
var w = window;
w.addEventListener ? w.addEventListener("load",function(){document.body.addEventListener("click",_gaLt,!1)},!1)
: w.attachEvent && w.attachEvent("onload",function(){document.body.attachEvent("onclick",_gaLt)});