【问题标题】:Google Analytics Ecommerce Tracking error in Magento 1.5.1 CEMagento 1.5.1 CE 中的 Google Analytics 电子商务跟踪错误
【发布时间】: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


    【解决方案1】:

    好的,以防万一其他人遇到我这样的问题......

    我尝试了我在网上找到的所有解决方案,但没有任何运气......今天我只需要安装另一个结帐扩展程序(我之前使用过“一步结帐”,但它有问题),现在谷歌也跟踪电子商务交易......

    所以,如果你遇到像我这样的问题,请确保扩展程序没有任何问题......

    祝你好运! :))

    【讨论】:

      【解决方案2】:

      就像代码上的 FYI - 我不使用 PHP,但是使用 Google Analytics,您希望阅读您提到的行:

      _gaq.push(["_setDomainName", "mydomain.com"]);
      

      所以摆脱 www。和 index.php 完全。

      另外,如果您只是在子域之间进行跟踪,而不是在两个不同的域之间进行跟踪,则需要删除 _gaq.push(["_setAllowHash", false]);线。

      【讨论】:

        猜你喜欢
        • 2014-09-17
        • 1970-01-01
        • 2011-08-01
        • 2013-01-08
        • 1970-01-01
        • 2018-12-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多