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
Usage and configuring i3 window manager in Ubuntu Jagadeesh V

i3 is a tiling window manager, tiling window manager is non-overlapping frames of application windows. In this tutorial you will learn how to install i3wm

Continue Reading...
Facebook integration in your website Ashwin Kumar

Using Facebook integration, we can get the user verified email id, general information, friends, pages, groups and you can post on his profile, facebook pages, ...

Continue Reading...
Understanding Audio Quality: Bit Rate, Sample Rate Sandeep Jagata

Audio Quality is the accuracy and enjoyability of the audio which the user can listen from an electronic device. Audio quality depends upon the bit ...

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