Tracking your Product Sales, Views and Searches with Google Enhanced E-commerce Analytics

Reading Time : ~ .

Enhanced E-commerce helps improving tracking of an e-commerce website. It gives Statistics in variable measurements. It is not be used alongside analytics plugin, as this EE  Plugin also tracks pages.

Enabling Enhanced Ecommerce:

Admin Section of Google Analytics Property will have three sub-sections: Account, Property View.

To enable Enhanced E-commerce you need to navigate to View > Ecommerce Settings > Turn Status & Enable Related Products to "ON" and click Submit.

Sending E-commerce Data:

Your normal Analytics Snippet will look like

<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-xxxxxxxx-1', 'auto');
  ga('send', 'pageview');
</script>

Here   ga('create', 'UA-xxxxxxxx-1', 'auto') will create a page object and  ga('send', 'pageview') will send the object to google tracker. So all the Ecommerce tracking will happen in between these Lines.

Add 

ga('require', 'ec');

to load e-commerce plugin, this should be after the creation of page object.

Sample Product List View Code :

ga('create', 'UA-xxxxxxxx-1', 'auto')
ga('require', 'ec');
ga('ec:addProduct', {               // Provide product details in a productFieldObject.
  'id': 'E60152',                   // Product ID (string).
  'name': 'Sandisk Pen Drive', // Product name (string).
  'category': 'electronics',            // Product category (string).
  'brand': 'Sandisk',                // Product brand (string).
  'variant': 'On-The-Go Pendrive',               // Product variant (string).
  'custom-dimension': 'custom-answer'
});
ga('ec:setAction', 'click', {       // click action.
  'list': 'Search Results'          // Product list (string).
});
ga('send', 'pageview')

Data Types:

  1. Impression data - Data of product that is already viewed
  2. product data -  Data of a product under view.
  3. promotion data -Data of Promotion object
  4. action data. - Type of Action

In our case scenario to Track Products Sales and views, we will use product data + Action data

Similarly,

Product Detail View :

ga('ec:addProduct', {               // Provide product details in a productFieldObject.
  'id': 'E60152',                   // Product ID (string).
  'name': 'Sandisk Pen Drive', // Product name (string).
  'category': 'electronics',            // Product category (string).
  'brand': 'Sandisk',                // Product brand (string).
  'variant': 'On-The-Go Pendrive',               // Product variant (string).
  'custom-dimension': 'custom-answer'
});

ga('ec:setAction', 'detail');         ----------> Action Data

Product checkout :

ga('ec:addProduct', {               // Provide product details in a productFieldObject.
  'id': 'E60152',                   // Product ID (string).
  'name': 'Sandisk Pen Drive', // Product name (string).
  'category': 'electronics',            // Product category (string).
  'brand': 'Sandisk',                // Product brand (string).
  'variant': 'On-The-Go Pendrive',               // Product variant (string).
  'custom-dimension': 'custom-answer'
});

ga('ec:addProduct', {
  'id': 'H25482',
  'name': 'Skull Candy Go Pro Headset',
  'category': 'Accessories',
  'brand': 'Skull candy', 
  'variant': 'blue',               
});

ga('set', '&cu', 'EUR');

ga('ec:setAction', 'purchase', {
  'id': '1054412477',                         
  'revenue': '37.39',                     
});

 

You can view this data in Reporting > Conversions > Ecommerce.

In case if you're facing any issues, you can use GA Debug, an official chrome plugin offered by Google to view data being sent. 

Tracking Site Searches:

This can only be possible if search queries are GET queries, where we use special terms like "q=<search-term>" or "/q/<search-term>/" .. etc.,

Navigate to View Section of your account and click on "View Settings", Under "Site Search Settings" , change "Site search Tracking" to on and query parameter as the keyword after which search keyword follows, like in both the above cases query parameters is: "q".

Now you can see all the queries being made in Google Analytics under Reporting > Behaviour > Site Search.

 

    By Posted On
SENIOR DEVELOPER at MICROPYRAMID

Need any Help in your Project?Let's Talk

Latest Comments
Related Articles
Streaming Protocols continued... RTMP, MMS Ashwin Kumar

Streaming is the technique for transferring data at fixed rate in real time between the client and the server. There are many streaming protocols available ...

Continue Reading...
Being focused and Productive at your work Vinisha Naladala

Plan your tasks in a smart way to achieve success in your life. Here are some tips to help you work smarter so you can ...

Continue Reading...
How to get self motivated to achieve goals Anusha Damacharla

Self Motivation is important to achieve success in life. Motivation is what Pushes us to achieve our goals, One of the biggest challenge is meeting ...

Continue Reading...

Subscribe To our news letter

Subscribe to our news letter to receive latest blog posts into your inbox. Please fill your email address in the below form.
*We don't provide your email contact details to any third parties