2013-04-17 46 views
1

我在以下javascript代碼中發現問題非常麻煩。GA - 電子商務沒有跟蹤項目

Google Analytics(分析)正在跟蹤我的交易,但沒有顯示任何產品。

該代碼取自收件頁面的「查看源代碼」。

<script type="text/javascript"> 

var _gaq = _gaq || []; 
_gaq.push(['_setAccount', 'xxxxxxx-x']); // I replaced my account no. 
_gaq.push(['_trackPageview']); 
_gaq.push(['_set', 'currencyCode', 'DKK']); 

_gaq.push(['_addTrans', 
'28996', 
'xxxxx.xx', // I replaced the domainname with xxxxx.xx 
'104.00', 
'20.80', 
'0.00', 
'fredercia', 
'Denmark' 
]); 


_gaq.push(['_addItem', 
'28996', 
'150649', 
'BRAUN ORAL-B ELTANDB&#216;RSTE', 
'99.00', 
'1' 
]); 




_gaq.push(['_addItem', 
'28996', 
'150000', 
'5 dages LOP-salg', 
'5.00', 
'1' 
]); 


_gaq.push(['_trackTrans']); 

(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> 

任何人都可以在這裏看到問題嗎?

回答

1

看起來您缺少category參數_addItem - 請參閱Google Docs for _addItem

雖然category參數是可選的,但將其忽略會導致所需的quantity參數丟失。

我們可以傳遞category一個空字符串,如果你沒有一個:

_gaq.push(['_addItem', 
'28996', 
'150649', 
'BRAUN ORAL-B ELTANDB&#216;RSTE', 
'', 
'99.00', 
'1' 
]); 
+0

現在開始測試吧:) – MathiasH