【问题标题】:Google Analytics E-commerce tracking is not working With Custom PHPGoogle Analytics 电子商务跟踪不适用于自定义 PHP
【发布时间】:2014-11-05 21:42:58
【问题描述】:

我正在尝试使用来自 Google Analytics 的 analytics.jsecommerce.js 跟踪基于 PHP 的自定义捐赠表单数据

这是我的输出

` (函数(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(窗口,文档,'脚本','//www.google-analytics.com/analytics.js','ga'); ga('创建', 'UA-xxxxxxxx-x', 'auto'); ga('发送', '浏览量'); ga('要求', '显示功能'); ga('require', 'ecommerce', 'ecommerce.js'); 功能跟踪电子商务(){ this._addTrans = addTrans; this._addItem = addItems; this._trackTrans = trackTrans; } function addTrans(orderID,store,total,tax,shipping,city,state,country) { ga('电子商务:addTransaction',{ '120573112734':订单ID, “捐赠”:商店, “10.00”:总计, '': 税, '': 航运, '测试',: 城市, “测试”:状态, “测试”:国家 }); } 函数 addItems(orderID,sku,product,variation,price,qty) { ga('电子商务:addItem',{ '120573112734':订单ID, “捐赠”:sku, “捐赠”:产品, “无”:变化, “1.00”:价格, “1”:数量 }); } 函数轨道传输(){ ga('电子商务:发送'); } var pageTracker = new trackEcommerce(); `

我不确定为什么 Google Analytics(分析)电子商务部分没有捕获这些数据,虽然我可以在 Google Analytics(分析)的感谢页面上看到统计数据

如果我做的不对,请帮忙。 再次感谢。

【问题讨论】:

  • 数据需要 24 小时才能完成处理,您等了多长时间?
  • 我昨天做了一些交易现在我再次查看它,它不存在:(虽然我在同一域上来自 Woo-Commarece 的其他产品照常实时推出。跨度>

标签: javascript php google-analytics e-commerce


【解决方案1】:

您的对象将值作为名称而不是实际的属性名称。

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-xxxxxxxx-x', 'auto');
ga('send', 'pageview');
ga('require', 'displayfeatures');
ga('require', 'ecommerce', 'ecommerce.js');

// Note the different names on the object properties? 
ga('ecommerce:addTransaction', {
    'orderID': '120573112734',
    'store': 'Donation',
    'total': '10.00',
    'tax': '',
    'shipping': '',
    'city': 'test',
    'state': 'test',
    'country': 'test'
});
ga('ecommerce:addItem', {
    'orderID': '120573112734',
    'sku': 'Donate',
    'product': 'Donation',
    'variation': 'none',
    'price': '1.00',
    'qty': '1'
});
ga('ecommerce:send');

【讨论】:

  • 做出了改变,但仍然没有帮助。谢谢
猜你喜欢
  • 2014-09-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-08-01
  • 2013-01-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多