New Google Analytics Event Tracking Wont Work On Mailto
I'm using the latest Google Analytics code: (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r; i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*n
Solution 1:
I found a relevant thread here: Google Analytics Event Tracking not firing for multiple accounts on Chrome ONLY
So in the end I got it working with chrome - this is how it looks now for those interested:
<a onclick="setTimeout(function(){ga('send', 'event', 'Email', 'Person Name');}, 1500);" href="mailto:email@address.com" >
A timeout function had to be added.
As Eduardo pointed out above another option that worked was having a mousedown function:
<a onmousedown="ga('send', 'event', 'Email', 'Person Name');" href="mailto:email@address.com" >
Solution 2:
Universal Analytics has built-in functionality for delaying sends called hitCallback.
ga('send', 'event', 'Contact', 'Email', 'Name here', {
'hitCallback': function() {
document.location.href = this.href
}
});
Haven't tested it, but should be pretty close to working. Google-around for other ideas.
Post a Comment for "New Google Analytics Event Tracking Wont Work On Mailto"