What's wrong with following google ecommerce analytics code
I have waited for more than 72 hours but ecommerce data is not tracked. Tracking is enabled in the analytics acc开发者_开发知识库ount.
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxx-1']);
_gaq.push(['_setDomainName', '.welcome.com']);
_gaq.push(['_trackPageview']);
_gaq.push(['_trackPageLoadTime']);
_gaq.push(['_addTrans',
'650', // order ID - required
'bags', // affiliation or store name
'19.99', // total - required
'0',
'4.0', // shipping
'Anchorage', // city
'Alaska', // state or province
'USA'
]);
//Add each items in the order
_gaq.push(['_addItem',
'650', // order ID - necessary to associate item with transaction
'29', // SKU/code - required
'bags set of 4', // product name
'Cleaning Supplies', // category or variation
'15.99', // unit price - required
'1'
);
//Now submit the transaction
_gaq.push(['_trackTrans']); //submits transaction to the Analytics server
(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>
</body>
I think you are missing a closing bracket:
//Add each items in the order
_gaq.push(['_addItem',
'650', // order ID - necessary to associate item with transaction
'29', // SKU/code - required
'bags set of 4', // product name
'Cleaning Supplies', // category or variation
'15.99', // unit price - required
'1'
]); //right here, missing closing bracket
精彩评论