I have a simple line of code as below:
<a href="http://sub.domain.org" onmousedown="trackOutboundLink('http://sub.domain.org'); return false;" >
With JavaScript:
var trackOutboundLink = function(url) {
ga('send', 'event', 'referral', 'click', url, {
'transport': 'beacon',
'hitCallback': function(){document.location = url;}
});
}
I want to to track the clicks on the link, but I have onmousedown
for the tracking for people who right click and open in new tab (I realize it won't be perfectly accurate, but that's ok).
The thing is, when you right click on the link, the page loads to the link now. I have removed the onmousedown
command and the problem goes away, so I know it's that.
I though the return false
is meant to prevent this? Thank you in advance for any help