2012-10-09 286 views
0

我最近更新了其中一个网站的Google Analytics(分析)跟踪代码,使其成为最新(异步)版本。自从这样做以后,它不能正确地跟踪链接。所有链接都是作为推介而不是具有我在传入链接中指定的Analytics(分析)utm参数(即关键字,来源,广告系列等)。Google Analytics(分析)无法正确跟踪

我还在网站上添加了Google自定义搜索引擎。这是一个什么样的代码示例(使用假账号等)的页面(Analytics(分析)和CSE代码)的结束标记的前面:

<script type="text/javascript"> 

    var _gaq = _gaq || []; 
    _gaq.push(['_setAccount', 'UA-XXXXXXXXX-X']); 
    _gaq.push(['_setDomainName', 'sitedomain.com']); 
    _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> 
<script type="text/javascript"> 
    (function() { 
    var cx = '0000000000000000:aksjfhkjw'; 
    var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true; 
    gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + 
     '//www.google.com/cse/cse.js?cx=' + cx; 
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s); 
    })(); 
</script> 

这有什么错与上述?例如,是否应该以任何方式修改常规Google Analytics脚本,因为我在同一页面上有cse?

感谢您的帮助!

回答

0

我不认为你的代码看起来不错。

这里是我使用的是什么了谷歌分析代码:

<script type="text/javascript"> 

     var _gaq = _gaq || []; 
     _gaq.push(['_setAccount', 'UA-xxxxxxxxxx']); 
     _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> 

我没有对我们的域名网站的搜索,但是这肯定是够的数据进入GA。这可能是您的_gaq.push(['_setDomainName', 'sitedomain.com']);正在被阅读为推介。试试看,让我知道。

相关问题