How to fix gtm audit on Adobe Commerce (Magento)

Install Google Tag Manager on your store and configure GA4 with ecommerce event tracking (view_item, add_to_cart, purchase) so you can measure what's driving revenue.

Steps for Adobe Commerce (Magento)

  1. Install the GTM container snippet via a Magento extension such as 'MagePal Google Tag Manager' (free, available on GitHub/Packagist) or 'Tagalys GTM' for a managed solution.
  2. Run: composer require magepal/magento2-google-tag-manager and then php bin/magento setup:upgrade in your Magento CLI.
  3. Configure the extension in Admin → Stores → Configuration → MagePal → Google Tag Manager: enter your GTM Container ID and enable enhanced ecommerce (automatically pushes view_item, add_to_cart, purchase to the dataLayer).
  4. Alternatively, add GTM snippets manually to app/design/frontend/<Vendor>/<theme>/Magento_Theme/templates/root.phtml in the <head> and after the opening <body> tag.
  5. In GTM, create GA4 Configuration and Event tags. Verify with GTM Preview and GA4 DebugView, flush the Magento cache (System → Cache Management → Flush Cache Storage), then publish.
Official Adobe Commerce (Magento) documentation ↗
<!-- GTM Head Snippet — paste inside <head> -->
<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=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXX');</script>

<!-- GTM Body Snippet — paste immediately after opening <body> -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>

<!-- Example GA4 purchase dataLayer push (server or theme renders this on order-confirmation page) -->
<script>
  window.dataLayer = window.dataLayer || [];
  dataLayer.push({
    event: 'purchase',
    ecommerce: {
      transaction_id: 'T_12345',
      value: 59.99,
      currency: 'USD',
      items: [{
        item_id: 'SKU_001',
        item_name: 'Blue Widget',
        price: 29.99,
        quantity: 2
      }]
    }
  });
</script>

What is gtm audit?

Google Tag Manager (GTM) is a free tool from Google that lets you add and manage marketing and analytics scripts on your website without touching code every time. Inside GTM, you install Google Analytics 4 (GA4) along with ecommerce event tracking — signals that fire whenever a shopper views a product, adds something to their cart, or completes a purchase. Think of GTM as a control panel for all the measurement tags on your store, and GA4 as the reporting dashboard that tells you exactly what those shoppers did.

Without GTM and GA4 ecommerce tracking, you are flying blind: you cannot see which traffic sources, products, or promotions actually generate sales. This means you risk wasting ad budget on campaigns that don't convert, missing opportunities to fix high-abandonment checkout steps, and losing the ability to build remarketing audiences for Google Ads and Meta. GA4's purchase data also feeds Google's Smart Bidding algorithms — without it, paid campaigns perform significantly worse, directly costing you revenue. Many regulations and platform policies also require transparent data practices, so having a properly managed tag infrastructure keeps you in control of what fires on your site.

See the complete Gtm audit guide for every platform and the full background.

Not sure if your Adobe Commerce (Magento) store has this?

Run a free SEOLZ audit — we’ll find gtm audit and every other issue across your whole site.

Scan my site free

Fix gtm audit on another platform