I'm having trouble getting Google Analytics to track transactions for commerce. Here's the code I'm generating on my order confirmation page.
I don't know how to debug this either, I can't find information on how to get error codes out of google's js. I'd run it in firebug's console if I could. At this point I'm stuck on how to proceed.
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-########-#']);
_gaq.push(['_setDomainName', '.mydomain.com']);
_gaq.push(['_trackPageview']);
_gaq.push(['_addTrans',
'117', // order ID - required
'StoreName.com', // affiliation or store name
'35.96', // total - required
'0', // tax
'0', // shipping
'', // city
'', // state or province
'' // country
]);
_gaq.push(['_addItem',
'117', // order ID - required
'1', // SKU/code - required
'1 Pack', // product name
'Catagory5', // catagory
'35.96, // unit price - required
'1' // quantity - required
]);
_gaq.push(['_trackTrans']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('h开发者_C百科ttps:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
})();
</script>
Thank you for any suggestions.
Checkout this page on Google Code. It provides an example of what your trying to do.
精彩评论