2013-11-26 103 views
2

谷歌標籤助理報告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但沒有什麼像這樣的開發者文檔。

回答

3

我認爲您現在可以忽略來自Google Tag Assistant的投訴。 AFAIK,標籤助手不知道電子商務,並且正在拋出誤報。

此外,請不要使用ga('send', 'ecommerce');意想不到的建議。它不會將數據正確地發送到GA服務器。

我發現這個問題已經打開很長一段時間了,如果問題已經解決了,並且命令ga('ecommerce:send');爲您工作,請將答案標記爲正確,以免看到此問題的人感到困惑。

1

如果在Google Analytics中正確報告交易,那麼您應該沒問題。 我懷疑谷歌仍在制定標籤助理和通用Analytics(analytics.js

之間蟲子從看在Google+ Tag Assistant Community,似乎標籤助理錯誤地報告與addTransaction一個錯誤(因爲它曾經是ga.jsaddTrans

相關問題