Google Tag Manager in Magento: should you use default GTM or use a third-party GTM module

The new free Magento Open Source 2.4.5 has received an important functionality, which was previously embedded only in the paid version of Magento Adobe Commerce. It is a built-in Google Tag Manager module. Such a module is a must-have for any online business since it connects a store to Google Analytics (GA) service.

But long before Magento received a built-in connector to Google Tag Manager (GTM), stores were already able to enroll in this Google service. They could connect to the Tag Manager with a third-party solution.

So now store owners can decide whether they will be enough with a free built-in solution or if purchasing a third-party module will bring more advantages.

We have prepared an overview of the Magento built-in Google Tag Module and compared it with a Google Tag Manager & Facebook Pixel by Mirasvit.

  1. Why your Magento store should use Google Tag Manager
  2. Google Tag Manager: Magento built-in vs. Mirasvit solution
  3. Summary

Why your Magento store should use Google Tag Manager

Short answer

Your Magento store should use the Google Tag Manager service to send data on user activity to Google Analytics suite after July 2023.

Expanded answer

Currently, the two Google Analytics suits are available - Google Analytics 3 (Universal Analytics) and newer Google Analytics 4 (GA4).

As of now, you can continue to use Google Analytics 3; however, it will be shut down starting in July 2023. All of its users will have to transition to Google Analytics 4. Read in detail what GA 4 is and what advantages it brings.

Google Analytics 4 requires for its operation a Google Tag Manager (GTM) service. It serves as an intermediary, gathering events on a website and sending this information to the analytics suite.

For a GTM service to work, only two code snippets must be embedded in the website. After that, all the work is done via a web interface at

These two GTM code snippets should be embedded in the store's frontend. A special GTM module is used to simplify embedding in Magento.

Google Tag Manager: Magento built-in vs. Mirasvit solution

Magento Open Source 2.4.5 received a built-in GTM connector and became ready-compatible with Google Analytics 4. Stores on Magento Open Source 2.4.4 and earlier can out of the box use only depreciated Google Analytics 3. They have to use a third-party GTM connector extension to use Google Analytics 4.

In Magento 2.4.5, you can navigate to Stores > Configuration > Sales > Google API > Google GTag to connect your store to GTM.

Here is how the functionality of the Magento built-in GTM module compares with a Google Tag Manager & Facebook Pixel for Magento 2 by Mirasvit.

Magento version compatibility

A Magento built-in GTM module is available starting from Magento Open Source 2.4.5 version. Adobe Commerce edition of Magento provides a built-in GTM module starting with version 2.3.

The GTM extension by Mirasvit is compatible with Magento version 2.3 - 2.4.5.

Summary: If, for some reason, you do not plan to update your store to Magento 2.4.5 - you will have to use a third-party GTM solution.

Enabling GTM in your store

A single and critical step in connecting your Magento store to the Google Tag Manager service is to embed two GTM code snippets in the frontend of your store. One code snippet should be placed within the <head> block of each page, and the other - in the <body> block.

Magento's built-in GTM module embeds the code snippets via configuring your current frontend theme. Navigate to Content > Design > Configuration > Store View > Edit.

On the Store View edit page, scroll down to HTML Head, expand it, locate the Scripts and Style Sheets field and paste the <head> GTM code snippet.

Next, find a Footer block and paste a <body> GTM code snippet in the Miscellaneous HTML field.

The GTM extension by Mirasvit offers on its configuration page fields for pasting <head> and <body> snippets.

Summary: Enabling GTM in your store is a simple process that requires no coding.

Configuring GTM tags

After the GTM code snippets are placed in your Magento store, all other GTM configuration is conducted via the web interface of the Google Tag Manager service on

You will have to add tags, triggers, and variables for them. Read more on Google Tag Manager's basic principles. The task of creating tags, triggers, and variables is not an easy one if you do it for the first time.

The Magento built-in GTM module leaves it up to you to create every tracking tag. Adobe provides a template set of basic tags GTM_M2_Config_json.txt file that you can modify for your IDs to get started.

The GTM by Mirasvit automatically creates a set of basic tags, triggers, and variables with your IDs in GTM and Google Analytics. You can import this JSON file into your GTM account instantly.

Download the import file for Google Analytics 4, Google Analytics 3, and Google Ads Conversion. You can use this import file as an example for understanding the tag structure.

Summary: Mirasvit GTM module automatically generates JSON import files. This helps you to reduce the chances of errors in configuring your tracking tags.

GTM debugging

In some cases, the GTM service may not receive tracking data even though the tags are configured. This is a common situation that requires some debug work.

Magento built-in GTM module offers using tools provided by Google in the Tag Manager's web interface or browser JavaScript console.

Extension by Mirasvit offers a built-in debug panel, which is accessible on any frontend page. It may be called when necessary by adding debug=gtm at the end of the page URL.

This panel helps to track what tags have been fired and what data was transferred.

Summary: With GTM by Mirasvit, you can debug tracking tags without leaving your store.

Additional functionality of GTM by Mirasvit

GTM logs

Record user activity in a store in a log file, which may be useful for debugging.

Facebook Pixel analytics

Facebook Pixel tracker support allows you to connect your Magento store to Facebook analytics. The latter is another analytics system that can be used simultaneously with Google Analytics.

Mapping product attributes and customer groups

Track product attributes which are not tracked automatically by Google Analytics. Manually configure Custom dimensions and metrics to receive data on these attributes in your analytic suite.

Additionally, enable Customer mapping to track your store visitors by their customer group.

Summary: A Mirasvit GTM supports tracking via Facebook Pixel in addition to tracking via Google Tag Manager.

Comparison table for GTM extensions

Here is a comparison table for the Magento Open Source built-in GTM module and a GTM extension by Mirasvit. It will help you easily see the functionality of each one.

Magento built-in GTM GTM by Mirasvit
Magento version support 2.4.5 2.3 - 2.4.5
Enabling GTM in a store Multi-step process One-step process
Creating basic GTM tracking tags Manual Generated automatically
Facebook Pixel
Google Ads Conversion
Attribute and customer group mapping
Frontend debug panel
GTM logs


Analytics is an essential part of keeping the efficiency of your Magento-based business. It helps to eliminate bottlenecks in the purchasing process, provide customers with a speed shopping experience, and boosts your profits.

Starting July 2023, Google Analytics will require connecting a store to the Google Tag Manager service. Update your store to Magento 2.4.5, and get a free tool to connect to GTM.

However, the Mirasvit GTM tool simplifies connecting the store to the GTM service and day-to-day tag operation. This extension automates some configuration steps and offers debugging tools for tags.

Eugen Barilyuk


Eugen, a tech-savvy writer at an IT company. He spends his days simplifying complicated tech stuff into easy-to-read blog posts and documentation. Eugen loves blending his love for tech with storytelling, making complex topics not only understandable but interesting. Beyond work, he enjoys exploring the creative side of technology and innovation.

Keep Learning