MathiasH
MathiasH

Reputation: 115

GA - E-commerce not tracking items

I have severe trouble finding the issue in the following javascript code.

Google Analytics is tracking my transactions just fine, but it does not show any products.

This code is taken from the "view sourcecode" at the receipt page.

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

Can anyone see the issue here?

Upvotes: 1

Views: 90

Answers (1)

mike
mike

Reputation: 7177

Looks like you're missing the category parameter to _addItem -- see the Google Docs for _addItem.

While the category parameter is optional, leaving it out will cause the required quantity parameter to be missed.

You can pass an empty string for category if you don't have one:

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

Upvotes: 1

Related Questions