Google Analytics - 记录出站链接 - 打开新窗口 [英] Google Analytics - Record Outbound Links - open new window

查看:20
本文介绍了Google Analytics - 记录出站链接 - 打开新窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了以下链接通过谷歌分析记录出站链接.是否可以在新窗口中打开链接?

I have used the following link to record outbound links through google analytics. Is it possible to open the link in a new window?

<script type="text/javascript">
function recordOutboundLink(link, category, action) 
{  
try {    
    var myTracker=_gat._getTrackerByName();    
    _gaq.push(['myTracker._trackEvent', category ,  action ]);    
    setTimeout('document.location = "' + link.href + '"', 100)  
 }
catch(err)
{
}
}
</script>

 <a href="http://www.example.com" onClick="recordOutboundLink(this, 'Outbound Links', 'example.com');return false;">

推荐答案

编辑,我忘了加 target="_blank":

edit, I forgot to add target="_blank":

我会用这种方式跟踪出站链接:

I would do it this way tracking outbound links:

<a href="http://outgoinglink.com" target="_blank" onclick="_gaq.push(['_trackEvent','outgoing_links','outgoinglink.com'])">Link Text</a>

这篇关于Google Analytics - 记录出站链接 - 打开新窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆