Last updated on August 28th, 2020 at 05:12 pm

Google analytics is very useful to keep track on website traffic we can check lots of information like Source of traffic, an active user on the website, the source of traffic no of visits and lot more useful information using Google Analytics. In my last post, I explain to you how to add Google Analytics in your Android Application. Now in this post, I show you how we can add Google E-commerce tracking in our E-commerce website. 

Google E-commerce tracking is very easy to implement. There is also Advance E-commerce tracking available which I will cover in next post. So without wasting your time, I jump to implement section. I hope you already know about Google Analytics and your website have Analytics code. Now you can follow below step to implement E-commerce tracking.

Step 1. Create Your Google Analytics Account and get Analytics Code and implement that code into your website.

Step 2. Now got to your setting page and select E-commerce setting and Enable E-commerce, for reference check below image.

Google Analytics For Ecommerce

Select E-commerce setting

Google Analytics For Ecommerce

Step 3. Now we can add tracking code in our analytics code. We can track our confirm order and send data to Google Analytics. You need to add code after your analytic code you need to call E-commerce module to track transaction

ga('require', 'ecommerce');

Now you need to Create transaction and add Item in it and submit it to Google using this method.


Please check below code for complete reference.

<script type="text/javascript">			
// Your Tracking code
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
ga('create', 'YOUR_TRACK_ID', 'auto');
ga('send', 'pageview');

// Add Google Tracking Code
ga('require', 'ecommerce');
ga('ecommerce:addTransaction', {
	'id': '123', // Transaction ID. Required.
	'affiliation': 'Offloo', // Affiliation or store name.
	'revenue': '10', // Grand Total.
	'shipping': '10', // Shipping.
	'tax': '0' // Tax.
ga('ecommerce:addItem', {
	'id': '123', // Transaction ID. Required.
	'name': 'Offloo Khadi', // Product name. Required.
	'sku': '1234', // SKU/code.
	'category': 'Khadi', // Category or variation.
	'price': '10', // Unit price.
	'quantity': '1' // Quantity.
// Send Data

After implementing this code you can refresh your page and check in Google analytics. To check go to Conversions -> Ecommerce.

This is very basic in my next post I will explain advance E-commerce tracking.

If this post helps you then Like our Facebook Page.