Enhanced E-commerce(EEC) is a Google Analytics plug-in, which gives us the opportunity to get better insights in the shopping behavior of our users.
Below are the steps to configure enhanced e-commerce for Shopify:
- Go to your Shopify Store.
- Go to online store>Prefrences.
- Enter Tracking Code in Google Analytics account and then click on save.
- In the Google Analytics section, click the Use Enhanced E-commerce section checkbox.
- Click Save.
(Images attached below for your reference)
Below are the steps to Enable enhanced e-commerce:
Go to Your Google Analytics account:
- Click on Admin.
- In the view menu, click E-commerce setting.
- Click the Enable Enhanced E-commerce Reporting toggle to turn it from OFF to ON.
- Click Save.
(Images attached below for your reference)
How to get the Tracking code:
- Go to Admin in Google Analytics.
- Go to the property settings.
- Then click on Tracking Info
- Copy this tracking code and paste it in Shopify.
Implementation for Non-Shopify Clients
Now paste the below Javascript code to GTM that will load the enhanced e-commerce plugin
<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', {{GA_pixel_id}}, 'auto', 'adyogi');
ga('adyogi.require', 'ec');
</script>
This plugin contains various methods that we can use to collect ecommerce data.
1- GA Add to cart -
<script>
ga('adyogi.ec:addProduct', {
'id': {{product_id}},
'name': {{product_name}},
'category': {{product_category}},
'price': {{discount_product_price}},
'quantity': 1
});
ga('adyogi.ec:setAction', 'add');