开发者

Analytics - Email tracking

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(['_trackEve开发者_如何转开发nt', '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


Wild guess :

Does adding javascript: before the content of your onClick even solves it ?

<a href="mailto:mail@mail.sk" onClick="javascript:_gaq.push(['_trackEvent', 'Index','Klik - email','mail@mail.sk']);">mail@mail.sk</a>


I am assuming these links will be visible in email clients such as outlook and Gmail. Most, if not all, email clients strip all JavaScript out of email messages before displaying them. If you would like to track email opens and other such information your only option is to use pixel tracking methods.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜