How to use Google Tag Manager(GTM) to Setup Universal Analytics for Magento2 Store?


Google tag manager is a tool provided by Google to easily update tags and code snippets on your website that generally requires technical knowledge. You must be wondering what is a tag? Well, a tag is basically a code snippet that sends information to a third party such as Google. If you do not use a tool such as the Google Tag Manager(GTM) then you will have to add code snippets directly into the files of your website. GTM automates this process and provides you with a simple user interface to manage all of your tags in one place.

You can use its enhanced e-commerce tracking features and also many other tracking features such as Facebook, Google Analytics, Google AdWords, and many more. Today we will look at setting up universal analytics via google tag manager as well as a unique plugin that will help automate this process.

How To Setup Universal Analytics Using Google Tag Manager(GTM)?

In order to Setup Universal analytics, you will need a GTM account if you do not have one then you must signup first. After that navigate to tags and create a new tag for Universal Analytics. Edit the configurations such as tracking type, tacking Id, etc. Lastly, set up a trigger so that your analytics gets fired when a certain event takes place on your page such as the click of a button, checkout, etc.

However, there is a catch. In order for you to get several features such as flexibility, portability, etc, you will need to add data layers manually. You will deploy Google tag manager alongside a data layer to get the maximum benefits. Typically a data layer is an object that contains all the information that you want to pass to GTM.  This information can be variables or events. you can set up your triggers based on the value from these variables or events. For instance, when the total purchase value exceeds a certain amount then your tag will fire up.

Data Layer

You can use the data layer to keep track of several enhanced e-commerce activities such as product impressions, product clicks, Add/Remove from the cart, and many more. Let us look at product impressions for reference.

Product Impressions

Suppose you want to measure product impressions through universal analytics. Then your tag configuration would be something like this:-

  • Tag type: Universal Analytics
  • Track type: Pageview
  • Enable Enhanced Ecommerce Features: True
  • Use Data Layer: True
  • Trigger: You will have to set the trigger event equal to gtm.dom

The data layer for the above tag is shown below. where we use two objects namely impressions and impressionFieldObjects. we send the product impressions by pushing the impressions object that contains one or more impressionFieldObjects. For further reference check the data layer snippet in the image below:-

Similarly, you can measure other enhanced e-commerce activities. For further reference click HERE. You need to add the code snippets of these data layers in the head tag of your pages. Although it requires some technical knowledge and something could go wrong very easily.  Worry not we have an easy solution if you want to set up Google Tag Manager(GTM) for your Magento2 Store. Check out our Magento 2 Google Tag Manager (GTM) Enhanced Ecommerce Tracking plugin. This plugin will help you easily set things up by automating the entire process. Let us see how this plugin works and what are its features?

What are the Features of This Plugin?

This extension will help you integrate Universal Analytics, Google AdWords, Facebook conversion, and a whole fleet of other tracking features via Google Tag Manager(GTM). It works by automatically creating data layers for each of these tracking services.  We also provide GTM friendly JSON files that you can directly import by logging in to your GTM account. You can check out more of its features and also view the demo for yourself HERE. If you have still not migrated from Magento 1 then we also have a similar version of this plugin specifically for Magento 1 as well.  You can check it out HERE.

[embedded content]

Discover more from WHO WILL CARE eCommerce

Subscribe now to keep reading and get access to the full archive.

Continue reading