Skip to content

Commit 169561b

Browse files
committed
Handle analytics for downloads without target blank.
Use a timeout of 200ms to let GA do its job.
1 parent ba720c1 commit 169561b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

_includes/headerbottom.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@
3232
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
3333
})();
3434
var f = function(event){
35-
_gaq.push(['_trackEvent','Downloads','Download',$(this).attr('href')]);
35+
var href = $(this).attr('href');
36+
var target = $(this).attr('target');
37+
_gaq.push(['_trackEvent','Downloads','Download',href]);
38+
if (target === undefined || target.toLowerCase() != '_blank') {
39+
setTimeout(function() { location.href = href; }, 200);
40+
return false;
41+
}
3642
};
3743
function endsWith(str, suffix) {
3844
return str.indexOf(suffix, str.length - suffix.length) !== -1;

0 commit comments

Comments
 (0)