Add external link tracking

This commit is contained in:
Cameron Gutman
2015-11-22 15:10:14 -08:00
parent c473932ff4
commit 3987fbd445

View File

@@ -247,6 +247,11 @@
ga('create', 'UA-47339221-1', 'auto');
ga('send', 'pageview');
!function(t){"use strict";var e=window.location.host;t("body").on("click",function(n){
function o(){document.location=a}if(!n.isDefaultPrevented()&&"function"==typeof ga){
var i=t(n.target).closest("a");if(1==i.length&&e!=i[0].host){n.preventDefault();
var a=i[0].href;ga("send",{hitType:"event",eventCategory:"outbound",eventAction:"link",
eventLabel:a,hitCallback:o}),setTimeout(o,1e3)}}})}(jQuery);
</script>
</body>