Reputation: 2595
The code is provided below. I include it in the thank you page.
##ITEM# - these are the replace codes and they are working just fine.
What is the issue?
<!-- GOOGLE ANALYTICS ECOMMERCE CONVERSION TRACKING -->
<!-- https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce -->
<script>
ga('require', 'ecommerce', 'ecommerce.js');
ga('ecommerce:addTransaction', {
'id': ##ORDER_ID#, // Transaction ID. Required.
'revenue': ##ORDER_PRICE#, // Grand Total.
'tax': ##ORDER_PRICE_TAX# // Tax.
});
ga('ecommerce:send');
</script>
<!-- END: GOOGLE ANALYTICS CONVERSION TRACKING -->
Upvotes: 4
Views: 4992
Reputation: 51
You must activate the GA - ecommerce option.
GA : Admin -> Ecommerce Settings -> Enable Ecommerce -> Status : ON
Upvotes: 2
Reputation: 911
I have integrated ecommnerce code in my project and it is working fine for me. below I have added the code.
<script>
(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','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXX-Y', 'auto');
ga('send', 'pageview');
ga('require', 'ecommerce', 'ecommerce.js'); // Load the ecommerce plug-in.
ga('ecommerce:addTransaction', {
'id': '1234', // Transaction ID. Required
'affiliation': 'Acme Clothing', // Affiliation or store name
'revenue': '11.99', // Grand Total
'shipping': '5', // Shipping
'tax': '1.29' // Tax
});
// addItem should be called for every item in the shopping cart.
ga('ecommerce:addItem', {
'id': '1234', // Transaction ID. Required
'name': 'T-Shirt', // Product name. Required
'sku': 'DD44', // SKU/code
'category': 'Green Medium', // Category or variation
'price': '11.99', // Unit price
'quantity': '1' // Quantity
});
</script>
Please go through the given link for more details : ecommerce tracking code
Happy Coding.. :-)
Upvotes: 4