Google Tag Manager with WooCommerce
I have recently launched a new eCommerce store for Rowgear Ltd. – http://rowgear.com. As part of the site build I wanted to make sure that they were set up with the best possible analytics solutions – with a very limited marketing budget it’s important they know who to target and how to target them.
The site is built on WordPress with WooCommerce powering the store. I opted to continue using Google Analytics as they were already on it but migrated to Universal Analytics and Google Tag Manager rather than sticking with the existing static tags. I also wanted to set them up on a CRM tool to enable effective outbound marketing but needed a cost-effective solution due to limited budget.
Google Tag Manager is an incredibly flexible tool, capable of managing all your marketing tags across all your websites. It’s also built to integrate directly with Universal Analytics, which means that with a correctly setup data layer you can have the full suite of Enhanced Ecommerce features working with just Four tags.
This does require you to have a data Layer setup in the right way, but this is a good idea anyway – having a robust data layer will future-proof your marketing activities. Google provides a guide on how the data Layer should be built here https://developers.google.com/tag-manager/enhanced-ecommerce#product-impressions.
Fortunately, to save you from having to build the data layer yourself, there is a WordPress plugin that does the vast majority of the work for you – https://wordpress.org/plugins/duracelltomi-google-tag-manager/. This plugin includes most of the data you will need and outputs it in a GTM-friendly manner including:
- post/page titles
- post/page dates
- post/page category names
- post/page tag names
- post/page author names
- post types
- post count on the current page + in the current category/tag/taxonomy
- logged in status
- logged in user role
- logged in user ID (to track cross device behaviour in Google Analytics)
- search data
There are a couple of data points that the plugin doesn’t provide but these can be easily added, for example, the plugin doesn’t provide the “product list” attribute for Enhanced Ecommerce. I wanted to make sure this was included so modified the plugin slightly to include it.
Also worth noting that the plugin doesn’t provide tracking for widget-based product lists such as “top rated products” or “recently viewed items” but I will cover how to track these later.
Once the plugin is setup it’s a simple case of creating the tags in Google Tag Manager. The four required tags for Enhanced Ecommerce tracking are:
- Page view
- Product clicks
- Add to Cart clicks
- Remove from cart clicks
Page view tag
In tag manager you need to set up your main Universal Analytics page view tag as normal, and then, under “more settings” select “Enable enhanced ecommerce features” and then select “use data layer”. This will automatically enable product impressions, checkout features and transaction tracking using the data layer created by the plugin above.
I also enabled the User ID feature which enables the cross-device reporting views in GA and lets you track logged in users across mobile, desktop and tablet, providing a new suite of reports.
Product, Add to cart and remove from cart tags
This tag requires you to set up an event track for the product click with enhanced ecommerce features enabled (the tag configuration for product click is shown below). You then set the tag to fire on the event “custom event equals productClick” – change productClick for the relevant event for Add / remove from Cart
With the data layer and these four tags setup you will start to see your enhanced ecommerce reports populating so you can start to better understand your ecommerce store performance. The zero’s in the screen below are because it’s a test account but it shows an example of the types of detail you can get.