Currently on our order confirmation page we have :
analytics.js :
/* Google Analytics */
(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','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-102324575-1', 'auto');
ga('require', 'GTM-WPS5DXR');
ga('send', 'pageview');
</script>
I want complete this code to send information about transaction in google analytics. So I add this code :
ga('require', 'ecommerce');
ga('ecommerce:addTransaction', {
'id': 'order_number',
'affiliation': 'affiliate1',
'revenue': 'order_amount',
'shipping': 'shipping_cost',
'tax': 'tax_amount'
}); '',
'currency': 'EUR'
});
ga('ecommerce:addItem', {
'id': 'order_id',
'name': 'product_name',
'price': 'product_price', < ! -- Unit price -- >
'quantity': 'product_quantity'
});
ga('ecommerce:send');
With that is it correct ?
Thanks a lot !
There is an inconsistence in this part:
The currency parameter must be specified within the ecommerce:addTransaction block and the ecommerce:addItem block. See an example in the documentation below:
https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#multicurrency