Google Analytics enhanced ecommerce expands traditional sales tracking to include shopping activity relating to products, promotions and the checkout process.
One aspect of this is product impressions. In a common setup this will push individual products as ‘product views’ into Google Analytics on category pages. Pairing this with click data provides product CTR (click through rate) which can be used to monitor product popularity and provide insight to improve the shopping experience.
The traditional solution to this is to push all impressions at once on the page load. In some instances this is flawed because not all impressions are true because one of more products may not actually be viewable to the user.
Tracking true impressions has always been quite experimental from a development perspective but the recent release of ‘IntersectionObserver’ into Chrome 51 looks to address this. This allows you to monitor the current visibility of selected elements. A polyfill is available to make this functionality available to other browsers.
Using ‘IntersectionObserver’ I’ll be building an example category page and push the relevant product values into Google Analytics when it becomes visible. This will use the Google Tag Manager / data layer method.
The category page HTML structure is fairly simple. Each product has an ‘item’ class applied as well as the relevant data attributes such as ID, price, position and name. In a real world example each item would have the relevant details to display to the user such as image, name and link. In my test I simply added a CSS ‘item’ class to give each item a set space on the page.
When an item becomes visible we ‘unobserve’ it so that particular product does not send an impression event again. The ‘threshold’ is set to 1.0 which means 100% of the selected element needs to be visible before the function is called.
Finally the Google Analytics event has been created which will fire when an event with name ‘productsImpression’ occurs. ‘Enable Enhanced Ecommerce Features’ and ‘Use data layer’ both need to be set to true. It would be recommended to change this event to a non-interaction hit as a product impression shouldn’t be classed as an interaction. Setting it as an interaction event would have a significant impact on reported bounce rate.
If we put all this together and you use a Google Analytics debugging tool you should start to see events like this occurring per product impression. Pretty cool, right?
Want to find out more about what Analytics & CRO can do for your business? Contact us here.