• By Kiwi Commerce
  • 14 Nov, 2025
  • Magento 2, Marketing

How to Install Google Tag Manager on Magento 2 / Adobe Commerce

Want to streamline your eCommerce tracking and enhance analytics? Google Tag Manager (GTM) simplifies the integration of marketing and analytics tags on your Magento 2 or Adobe Commerce store without modifying code. Kiwi Commerce also provides specialised Magento development and GTM implementation services to support accurate, reliable, and advanced tracking setups.

In this guide, we cover:

  • Features and benefits of Magento 2 GTM.
  • Step-by-step setup and configuration of GTM on Magento 2.
  • How GTM works with Google Analytics and GA4.
  • Advanced techniques for tracking conversions, video engagement, and user interactions.
  • Best practises, troubleshooting, and recommended extensions.

How Does Google Tag Manager Work?

GTM operates in three main phases:

Tag: Detects events on your site, such as clicks, form submissions, and conversions.

Trigger: Activates tags when specific actions occur, recording relevant data.

Variable: Captures detailed information about actions, like product IDs or basket values.

This modular approach makes tracking and marketing automation more flexible and powerful.



GTM Setup Fields for Magento 2

Technique Implementation Benefits
Custom Data Layer Events Track wishlist adds, product video interactions Granular insights into user behaviour
Enhanced Ecommerce Tracking Basket impressions, clicks, purchases Optimise product placement and marketing
Form Interaction Tracking Track submissions/abandonments Identify pain points, improve form completion
Scroll Depth Tracking Track scroll % on pages Understand content engagement
Video Engagement Tracking Track video plays, pauses, completions Inform video marketing strategy
Facebook Pixel Integration Add Facebook pixel without code Improve ad targeting and conversions
Hotjar Heatmaps Implement via GTM Visual insights into UX
Criteo Retargeting Implement through GTM Boost return visitor conversions
Klaviyo Email Marketing Send ecommerce data to Klaviyo Personalise campaigns, improve ROI
Checkout Step Tracking Track each checkout step Identify drop-offs, optimise flow
Google Ads Remarketing Target previous visitors Re-engage potential customers

4 Steps to Set Up Google Tag Manager in Magento 2

Step 1: Configure Google Analytics Account

  • Log in to Google Analytics.
  • Enable Site Search Tracking under View Settings (query parameter: q).
  • Turn on Advertising Features for demographics and interest reports.
  • Enable Ecommerce Tracking and Enhanced Ecommerce Reporting.
  • Reload the page to ensure all settings are enabled.

Step 2: Configure a New GTM Container

  • Download GTM_M2_Config_json.txt and save it as GTM_M2_Config.json.
  • Import it into GTM: Admin > Container > Import Container.
  • Choose New Workspace, select Overwrite or Merge, then preview.
  • Update your Google Analytics ID in Variables > User-Defined Variables.
  • Publish the container when ready.

Step 3: Configure Your Magento Store

  • Log in to Magento Admin: Stores > Configuration > Sales > Google API > Google Analytics.
  • Enable Google Tag Manager, enter your Container ID, and turn on content experiments if needed.
  • Save configuration and test settings.
  • Note: One container per website; multi-site setups require separate containers.

Step 4: Add GTM Code to Your Store

  • Copy GTM snippets for <head> and <body> from Admin > Install Google Tag Manager.
  • Go to Content > Design > Configuration > Store View > HTML Head & Footer.
  • Paste the <head> snippet in Scripts and Style Sheets and <body> snippet in Miscellaneous HTML.

Save Configuration.

Advanced Magento 2 Techniques Using GTM

Technique Implementation Benefits
Custom Data Layer Events Track wishlist adds, product video interactions Granular insights into user behaviour
Enhanced Ecommerce Tracking Basket impressions, clicks, purchases Optimise product placement and marketing
Form Interaction Tracking Track submissions/abandonments Identify pain points, improve form completion
Scroll Depth Tracking Track scroll % on pages Understand content engagement
Video Engagement Tracking Track video plays, pauses, completions Inform video marketing strategy
Facebook Pixel Integration Add Facebook pixel without code Improve ad targeting and conversions
Hotjar Heatmaps Implement via GTM Visual insights into UX
Criteo Retargeting Implement through GTM Boost return visitor conversions
Klaviyo Email Marketing Send ecommerce data to Klaviyo Personalise campaigns, improve ROI
Checkout Step Tracking Track each checkout step Identify drop-offs, optimise flow
Google Ads Remarketing Target previous visitors Re-engage potential customers

Creating a Conversion Tag in GTM

Step 1: Configure the module

  • Select your GTM container.
  • Add a new tag for Google AdWords Conversion Tracking with Conversion ID & Label.

Step 2: Create a trigger

  • Fire on specific pages (e.g., checkout/success.*) using URL RegEx.

Preview and publish the tag.

Best Practises for Implementing GTM in Magento 2

Category Best Practice Why It Matters
Performance Use built-in tag-firing priorities, limit custom HTML Speeds up page load, reduces code bloat
Security Strong passwords, 2FA, audit access Prevents unauthorised access
Integration Use native GTM module, consistent data layer Accurate data collection
Maintenance Track scroll depth, monitor triggers Optimise content engagement and layout

Recommended GTM Extensions for Magento 2

  • Magefan GTM Extension – Free, tracks 13+ eCommerce events, client & server-side tracking, no coding required.
  • Webkul Magento GA4 Extension – Advanced GA4 integration, Facebook Pixel, Google Ads remarketing. Pricing starts from £238.80 (Open Source Edition).

Testing & Troubleshooting

  • Use GTM Preview Mode to verify tag firing and data layer pushes.
  • Common issues: container not loading, tags not firing, incorrect GA4 data.
  • Monitor: container implementation, data layer consistency, tag & trigger accuracy.

Advanced tools: browser dev tools, GTM debug mode.

Summary

Magento 2 GTM streamlines tag management, enabling store owners to:

  • Track marketing and conversion events efficiently.
  • Enhance analytics and marketing decisions.
  • Simplify tag deployment without touching code.
  • Support both web and server containers.

Pair GTM with managed Magento hosting to maximise performance, ensure data accuracy, and optimise eCommerce tracking.

Kiwicommerce also provides professional assistance for configuring and implementing Google Tag Manager in Magento, making setup faster, more reliable, and fully aligned with your business requirements.

Leave a Reply

Your email address will not be published. Required fields are marked *