What is Google Tag Manager?

Google Tag Manager has been around a while but only recently has become used frequently by webmasters. It’s a free tool that makes it much easier to webmasters and marketers to add tags (or code) to help with conversion tracking, remarketing, and site analytics. More than just simple analytics, it allows enhanced analytics and tracking to develop core strategies and user integration on your site.

How To Add the GTM script to WooCommerce

Adding the script to your wordpress site is really easy, even though there is not much information for newbies on how to do this. Luckily the Google Tag Manager plugin makes things very simple, and recently they’ve added integration for WooCommerce. The main issue an confusion is that the information provided by GTM is to add a piece of code to your site. There are many tutorials on how to get you GTM script within your Google account. This one is good: http://www.wpbeginner.com/beginners-guide/how-to-install-and-setup-google-tag-manager-in-wordpress/   The general script that is provided is as per below:

adding google tag manger code to woocommerce

Adding the the first snippet of code is simple, and can be added directly after the <head> tags in your Theme Header (header.php) file. You find and edit this file as per below:


This part is simple, however adding the second part of the script is more confusing, as the <body> tag in WordPress and WooCommerce normally begins with a class hook. i.e <body <?php body class(); ?>> to fire in the theme functions (funtions.php) file. For the uninitiated this can be very confusing. There is a way to add the GTM code script to the functions file, but that can even more confusing and their is an easier way. Download the Google Tag Manager Worpdress Plugin here, and install.

adding google tag manager id

We’ve found that for some themes the codeless injection will not work. In this case we’ve found that the Footer options works, even though it’s not recommended by Google.


Add the Google Tag Assistant from here.  Once added to your Chrome browser you can check if the tag is firing. GTM is now installed and firing correctly on you site.

google tag assistant installation chrome