I'm trying to track my email links with Google Analytics, but for some reasons it does not work. Here is my code:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'xxxxxx']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
and here's the onClick function in page source code:
<a href="mailto:mail@mail.sk" onClick="_gaq.push(['_trackEvent', 'Index','Klik - email','mail@mail.sk']);">mail@mail.sk</a>
I tried same tracking for link on other page and it worked. After I installed GA Debug, I found out that when I'm tracking mailto link, error shows up - Failed to load resource: mailto:mail@mail.sk
Does somebody have any ideas why there is an error and how to fix it? Thanks