New Google Analytics event tracking will not work on mailto

I use 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*new Date();
         a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;
         a.src=g;m.parentNode.insertBefore(a,m) })
      (window,document,'script','//www.google-analytics.com/analytics.js','ga');

      ga('create', 'XXXXXXXXX', 'XXXXXXXX');   
      ga('send', 'pageview');

I have event tracking for working with a download link using the following:

<a href="#" onclick="ga('send', 'event', 'Download', 'PDF', 'FILE NAME');">

However, it does not work with the mailto link - when I look in the console, it says that the request has been canceled. This is what I use:

<a href="mailto:email@address.com" onclick="ga('send', 'event', 'Contact', 'Email', 'Name here');">

When I delete "mailto", it will track.

Am I installing it wrong?

EDIT: will appear if I set the goal = "_ blank", this will work - however, then another window opens, which is not ideal.

Second Edit: Something seems to be related to Chrome - I tested it in Firefox and IE, and it worked when I did it - has anyone else experienced this?

+3
source
2

: Google Analytics Chrome

, , - :

<a onclick="setTimeout(function(){ga('send', 'event', 'Email', 'Person Name');}, 1500);" href="mailto:email@address.com" >

-.

, , , mousedown:

<a onmousedown="ga('send', 'event', 'Email', 'Person Name');" href="mailto:email@address.com" >
+8

Universal Analytics , hitCallback.

ga('send', 'event', 'Contact', 'Email', 'Name here', {
  'hitCallback': function() {
    document.location.href = this.href
  }
});

, . Google-around .

0

All Articles