【发布时间】:2012-01-24 01:03:01
【问题描述】:
从 1.4.2 升级到 1.5.1 后,我的谷歌分析电子商务跟踪无法正常工作。 Google 会跟踪流量、访问者甚至目标……但 google 分析中的整个电子商务部分无法正常工作……
我在模板中的 googleanalytics.xml 中进行了更改,正如我在此处的一些线程上所读到的,它没有改变任何东西。
然后我根据这个帖子创建了 ga.php 覆盖:http://magentist.com/magento_help/magento-google-analytics-issues/
然而,谷歌分析有效,但分析中的电子商务跟踪不起作用。
当我购买时,我的成功页面的源代码在 body 标签关闭之前给出了这种代码:
<!-- BEGIN GOOGLE ANALYTICS CODE -->
<script type="text/javascript">
//<![CDATA[
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXX-X']);
_gaq.push(['_trackPageview']);
_gaq.push(["_setDomainName", "www.mydomain.comindex.php"]);
_gaq.push(["_setAllowHash", false]);
(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>
<!-- END GOOGLE ANALYTICS CODE --> </div>
如果你注意到了,那是 index.php 之前缺少正斜杠
_gaq.push(["_setDomainName", "www.mydomain.comindex.php"]);
我不知道可能是这个问题,谁能告诉我如何解决它?
我尝试了我在谷歌找到的所有解决方案,但都没有成功:((
这是我的 ga.php 覆盖中的函数的样子:
<!-- BEGIN GOOGLE ANALYTICS CODE -->
<script type="text/javascript">
//<![CDATA[
var _gaq = _gaq || [];
' . $this->_getPageTrackingCode($accountId) . '
_gaq.push(["_setDomainName", "' . $this->getDomainName() . '"]);
_gaq.push(["_setAllowHash", false]);
' . $this->_getOrdersTrackingCode() . '
(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>
<!-- END GOOGLE ANALYTICS CODE -->
我希望有一个解决方案。
提前谢谢你:))
【问题讨论】:
标签: magento google-analytics magento-1.5