Created
December 11, 2012 09:09
-
-
Save sampel/4257219 to your computer and use it in GitHub Desktop.
Adding Google Analytics event tracking to outbound links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
unction recordOutboundLink(link, category, action) { | |
try { | |
_gaq.push(['_trackEvent', category , action, 'visiting things']); | |
setTimeout('window.open("' + link.href + '")', 100); | |
} catch(err) { | |
console.error('Error recording outbound link.'); | |
} | |
} | |
$('.link-box').on("click", function() { | |
recordOutboundLink(this, 'CF Systems', this.href); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
here is the html:
<a href="http://tmview.europa.eu/tmview/welcome.html" class="link-box" target="_blank">