Skip to content

Commit d26c8b8

Browse files
committed
analytics for downloads and other non-html-links
1 parent a1b21bf commit d26c8b8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

_includes/headerbottom.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,18 @@
1111
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
1212
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
1313
})();
14-
14+
var f = function(event){
15+
_gaq.push(['_trackEvent','Downloads','Download',$(this).attr('href')]);
16+
};
17+
function endsWith(str, suffix) {
18+
return str.indexOf(suffix, str.length - suffix.length) !== -1;
19+
}
20+
$(function(){
21+
$('a').filter(function(){
22+
var href = $(this).attr('href');
23+
return !endsWith(href,'/') && !endsWith(href,'html');
24+
}).on('click',f);
25+
});
1526
</script>
1627
</head>
1728
<body>

0 commit comments

Comments
 (0)