How to Add & Config Google Tag Manager in Magento 2?

Jade avatar
Jade Updated: October 01, 2022


The Most Popular Extension Builder for Magento 2

With a big catalog of 234+ extensions for your online store

Google Tag Manager is an essential tool for online marketing activities. Having a proper tracking code installed into your site system will help you get analytics data easier and more accurate. The final result of the analytics will be the fundamental criteria to evaluate and make important decisions.

For starters, we all know Google tag manager brings multiple benefits but how can you experience all these benefits to the fullest? The answer is store integration. When this tool is integrated into your backend, you can gain more control with your store tags.

In this article, I will review and explain more about Google Tag Manager for Magento 2. Let’s learn how you can add and configure the Google Tag Manager to your Magento 2 store site via a third party!

Table of contents

What is Google Tag Manager?

Due to the existing disadvantages mentioned above, Google Tag Manager(GMT) is a free tool provided by Google. This tool is very effective, as the management activities will all happen in the Google Tag Manager system rather than editing site code. The tools bring numerous valuable benefits:

  • Help marketers to control the marketing campaign
  • Reduce errors when creating and updating tags
  • Deploy tags quickly
  • Free you from having involved with Webmaster

In addition, the tool can work with both Google tags and non-Google tags, which can be related to Facebook Pixel, Bing UET, or other third-party JavaScript to your site using Google Tag Manager. Right after you added the GTM to store sites can set up Google analytics and other supportive tools to track and report the website traffic.

To learn more about third-party services integration, you should keep reading more about Magento 2 Google Tag Manager.

What is a tag?

Tags are snippets of code which is added to your site to collect information and send it to third parties. Tags play the role of the optimizer for your site marketing activities by measuring your site traffic with ease

For a normal site, there is an abundance of tags attached which needs to be managed by a complex amount of code. Managing tags is an activity that consumes a lot of time. As a result, managing too many tags can make admins feel overload when it always requires them to create new tags and update old ones.

The consequence of tags overload will damage your store revenue. Besides, it can delay the marketing campaign due to the time-consuming activities of tags management. It can put your campaign on hold for a few weeks or even months which prevents store opportunities to boost sales.

How does GTM work?

Google Tag Manager process

Based on Psyberware, the writer clearly clarifies the GTM process in 3 main stages: Firstly, the event is a condition that possibly can occur on a website. The second stage triggers a response when the set event happens. And, the tag will do certain actions on a third party site.

For example, when you activate an analytics tag when a user loads a new page, the customer clicks on a webpage will be an Event that will match with Page Trigger. After that, the trigger will notify that the page is loaded to fire the analytics tag.

Why you need Magento 2 Google Tag Manager

Despite the Magento 2 Enterprise edition has already contained Google Tag Manager, the Open Source version is NOT fully geared with this GMT. This defect can prevent you from getting the benefits that your store could have. However, you can consider to integrate it into your store sites with a Google Tag Manager module. The significant benefits can be named:

Centralize Google Tag management system

With the help of the Mageplaza Google Tag Manager, stores can enjoy managing tags directly in the store site system. All the messy tags will be generated and upgraded easily. By keeping all the information in one system, stores organize data with ease.

Enhance the site’s performance

Many codes being added to the source of store sites are one of the contributing reasons that slow down the page’s loading speed. And, a website with a slow loading page will increase the bounce rate, and lower conversion rate. If you want to prevent the issue in the first place or mitigate the disadvantage, the module will be your optimal solution. With the assistant of the module, you can save more time for page loading by controlling all the script-tags and you only need to insert it into your sites. With a few seconds optimized for websites speed, your client expectation can be fulfilled and increase conversion rate.

Reduce cost in the long term

The simplified working process provided by GTM will help non-developers like store owners and marketers take the initiative to control the tags themselves. With less involved people, the store can save budget spending on hiring the developers. Time to maintain the extension and configuring basic codes will be a huge saving in the long term operation. Even when hiring a developer who takes care of GTM settings, you can make the process to move faster and still generate your savings.

Generate reports and analytics with Google Analytics

Google Analytics (GA) is another free tool provided by Google with the aim to create reports, statistics on your websites. Despite Google Analytics and Google Tag Manager can work separately from each other, GTM can act as a middleman to simplify data analytics process. Setting up GA through GTM will bring many benefits to your store:

  • Simplify the code in place on your store sites
  • Edit setting without development updates
  • Set up advanced features easier like domain tracking

Overall, you can gain better performance when integrating two of these tools together. Or, you can simply learn about Google Tag Manager extension which also features Google Analytics and Facebook Pixel.

How to add Google Tag Manager to Magento 2 store

It is possible for you to integrate this gadget without a middle man like an additional module. However, to activate integration is quite a bothersome task when compared with installing a module. Besides, Magento 2 Google Tag Manager by Mageplaza also featured with many more functionalities that await you to install to the store backend.

First off, before getting back to the admin panel, you should register a Google Tag Manager account via this link here.

Register a Google Tag Manager account

Then, input the required information for the registration process for your account.

add a new account

You can set up the “container”. The container is a set of rules, tags and macros which is configured for a specific site. You should fill the container with your website’s domain name. For stores that have multiple store sites, you will have to create several containers. Also, you should set it as “Web” Container as you are running a website, not a mobile app. Then, click Create.

After that, you can copy the code generated by the GTM system like below and paste it into each page of your store site.

Code generated by CTM system

Finally, you can access the Admin section to collect Container ID to install in Magento

Admin section

How to configure Magento 2 Google Tag Manager

General Configuration

You need to come back to the Magento Admin, choose Stores > Configuration > Mageplaza Extensions > Google Tag Manager. In the top field, select Yes in Enable field to activate the extension.

general configuration

Configure Google Tag Manager

configure Google Tag Manager

Next, select Yes in the second Enable Field to enable the use of the Google Tag Manager feature which helps to update and control all tags on the site.

For the Google Tag ID field, admins need to paste the Google Tag Manager’s Container ID to this field to update some information on an event. The event can be set in category page, product page, when adding to cart, remove from cart, order success, search, checkout default or checkout page of Single page Checkout extensions which help shorten checkout process to only 6 steps within a page and optimize the checkout process for customers.

If the field is left blank or filled with incorrect information, the Container ID will unable to display information in detail.

Tag manager

Note: You can activate the Google Tag Manager by creating Trigger then Tag and click Preview or Submit in case GTM is disabled.

trigger configuration

Final words

In a nutshell, Google Tag Manager provided by Mageplaza is the optimal solution which can help to reduce the number of the installed module. The module not only provides the function to manage tags for store sites but also provides Adwords, Facebook tracking, Google analytics within this module. With 4 of these tools all included in the GTM extension, you can manage all of them through the site. Hence, if you find difficulties in adding Google Tag Manager module to your store, Mageplaza support team will help you install the plugin to your Magento 2 store sites.


Magento Support
& Maintenance Services

Make sure your M2 store is not only in good shape but also thriving with a professional team yet at an affordable price.

Get Started
avada marketing automation

Jade is a content creator, book lover, and a hodophile. She loves to learn skills and practical knowledge to excel at marketing, especially content marketing.

People also searched for


Stay in the know

Get special offers on the latest news from Mageplaza.

Earn $10 in reward now!

Earn $10 in reward now!

go up