Where to start with Google Tag Manager & ecommerce tracking

Google Tag Manager is a great tool and is simple enough if you just want to add the standard Google Analytics page view tracking tag. But when more sophisticated tracking is required it can start to get more complicated.

If the site your working on is well established website with years of GA data it’s important that you do not skew the data even a few hours of missed data can affect your future reports. As a marketer I am always looking at comparison data such as year on year or month on month, so one error implementing Google Analytics could mess up your data, with your marketing team end jumping to the wrong conclusions when comparing periods of time in the future.

Last week I installed Google Tag Manager for a client with standard ecommerce tracking. This was only the second time I had been asked to install GTM – the first time was over 10 months ago and I hadn’t touched it since. I quickly realized once started that I had forgotten most of what I had learned previously.

Considering the site was over 17 years old and had over 15k visits a day I couldn’t messed this one up (the first job was for a brand new site). I spent nearly a whole day going through tutorials about GTM and the dataLayer and then got started. Although there are loads of tutorials about GTM there are not many many out there that explain how GTM, dataLayer and ecommerce tracking work.

Here is a guide for any newbies on where to start with Google Tag Manager.

Installing Google Tag Manager

  1. To install google tag manager go to https://tagmanager.google.com and set up an account, remembering that its best practice to setup one account per website and name the account according to business name.
  2. Next you have to setup a container (you should have 1 container per website). Then name the container after your website name and click Create container.
  3. Once you have created the container you will see a tag as below:

<!– Google Tag Manager –>
<noscript><iframe src=”//www.googletagmanager.com/ns.html?id=GTM-XXXX”
height=”0″ width=”0″ style=”display:none;visibility:hidden”></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({‘gtm.start’:
new Date().getTime(),event:’gtm.js’});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!=’dataLayer’?’&l=’+l:”;j.async=true;j.src=
‘//www.googletagmanager.com/gtm.js?id=’+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,’script’,’dataLayer’,’GTM-XXXX’);</script>
<!– End Google Tag Manager –>

make sure that you or your developer pastes the code directly after the opening body tags so that it looks like this:

<body>
<!– Google Tag Manager –>

 Setting up a Google Analytics with Google Tag Manager

 Firstly you will need to get your UA number from your Google Analytics account. This can be found in your Google Analytics by clicking on Admin >>property settings and your ID will display at the top and will be prefixed with the letters UA. Copy that then jump back in to Google Tag Manager and follow these steps:

  1. Click New Tag
  2. Call the tag Google Analytics
  3. Choose Product – Google Analytics
  4. Select Universal Analytics or Classic Analytics depending on what version of analytics you have. (I haven’t seen a site with Classic Analytics for a couple of years so most probably you will be using Universal Analytics).
  5. Configure Tag – Add your UA number in the field titled Tracking ID
  6. Keep Track Type as Page View
  7. Click enable advertising features
  8. Under Fire On select All Pages
  9. Click Create Tag
  10. A pop up titled rename will appear just click save if you have already named it.

*Note: Google Tag Manager is constantly evolving so the steps might be slightly different. The above is based on using version2.

Publishing and debugging your Google Analytics Tag

  1. Before publishing live you can preview by clicking the down arrow next to Publish and clicking Preview and Debug
  2. Then go to your site and you should get a window at the bottom of your screen. If installed correctly you should see your analytics tag firing as shown in the image below

Congratulations! You have successfully installed Google Tag Manager.

Tip: You can also check if your Google Analytics is tracking correctly by checking your Real Time stats in Google Analytics, click Content and then navigate to a page where you are sure there is no traffic and you should see your visit as an active page. If you see 2 visits simultaneously you need to make sure you have removed your old Google Analytics script from your pages otherwise you will record everything twice.

Read my next post in this series – Installing Google Analytics eCommerce tracking and adding a Data Layer.

Facebook
Twitter
LinkedIn
Pinterest