谷歌標籤助理報告2個嚴重錯誤:關鍵問題與Universal Analytics跟蹤的交易時Universal Analytics跟蹤交易時
Error: Unknown method name: 'addTransaction'
Error: Missing 1 required parameter(s) for method 'send'.
交易報告在谷歌分析,但我很擔心這樣的錯誤。這裏是我的報告代碼:
<script>
(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-1', {
'clientId': 'XXX'
});
ga('require', 'ecommerce', 'ecommerce.js');
ga('ecommerce:addTransaction', {
'id': '5',
'affiliation': 'xxx',
'revenue': '0', // revenue is 0 because discount coupon was applied
'shipping': '15',
'currency': 'CHF'
});
ga('ecommerce:addItem', {
'id': '5',
'name': 'XXX',
'sku': '3387',
'price': '35.80',
'quantity': '1'
});
ga('ecommerce:send');
ga('send', 'pageview');
</script>
在谷歌產品論壇用戶率性建議使用
ga('send', 'ecommerce');
見:http://productforums.google.com/d/msg/analytics/L6bWIxPtNbA/PKUJLCfz6qsJ但沒有什麼像這樣的開發者文檔。