# magepal/magento2-googletagmanager

> Google Tag Manager (GTM) for Magento 2 with Advance Data Layer

`composer require magepal/magento2-googletagmanager`

Canonical URL: https://packagento.com/magepal/magento2-googletagmanager

## At a glance

- **Vendor**: magepal (https://packagento.com/magepal.md)
- **Latest version**: 3.0.2 — released 2026-05-15
- **Pricing**: Free
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

Packagento is licence-gated, so even free packages need a licence on a project before Composer can resolve them.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Add the package to your account.** Open https://packagento.com/magepal/magento2-googletagmanager and complete the free checkout. A licence is minted automatically.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require magepal/magento2-googletagmanager:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

Google Tag Manager (GTM) for Magento 2 with Advance Data Layer

## README

<a href="https://www.magepal.com" title="Magento2 Custom Developer" ><img src="https://image.ibb.co/dHBkYH/Magepal_logo.png" width="100" align="right" alt="MagePal Adobe Commerce Extensions" /></a>

## Google Tag Manager for Magento 2 / Adobe Commerce with Advance Data Layer

[![Total Downloads](https://poser.okvpn.org/magepal/magento2-googletagmanager/downloads)](https://packagist.org/packages/magepal/magento2-googletagmanager)
[![Latest Stable Version](https://poser.okvpn.org/magepal/magento2-googletagmanager/v/stable)](https://packagist.org/packages/magepal/magento2-googletagmanager)

##### Whether you are a small Magento retailer or an Adobe Commerce Enterprise customer, our suite of Google Tag Manager extensions will help you integrate the most challenging GTM projects within days, instead of spending weeks or months creating custom solutions.
For Magento 2.0.x, 2.1.x, 2.2.x, 2.3.x and 2.4.x

<a href="https://www.magepal.com/magento2/extensions/digital-marketing.html"><img alt="Magento Enhanced Ecommerce for Google Tag Manager" src="https://user-images.githubusercontent.com/1415141/88172990-d89cd300-cbef-11ea-8a51-cc39f55b0218.png" /></a>

#### What is Google Tag Manager
Google Tag Manager (GTM) is a user-friendly, powerful and essential integration for every Magento store. It simplifies 
the process of adding, editing and managing third-party JavaScript tags and other snippets of code on your Magento site. 
With GTM, you can quickly and easily add Facebook tags, AdWords Conversion Tracking, Re-marketing, Bing UET, SnapChat, 
DoubleClick code, Google Analytics, and many more in a breeze without the need for a developer to make changes to your 
Magento code providing the data is available to Google Tag Manager. 

Google Tag Manager makes running your digital marketing campaigns much easier when calibrating with multiple department and Ad agencies by making available the right set of tools so that everyone can get their job done quickly without relying on developers. 

Without having the all data you need at your fingertips your integration will become a difficult, time-consuming and messy since each developer will only focus on the current task at hand instead of focusing on writing reusable components for future integration.

Our extension provides a vast array of over 60 preconfigure data layer elements to make integrating your Magento store with any other third-party service a breeze using Google Tag Manager. 
Extracting, customizing and adding your own custom data from your Magento store to Google Tag Manager is as easy as 10 lines of code using our easy to customize APIs.

>:warning: Google Tag Manager 2.7.0 has some breaking changes to Enhanced Ecommerce. Please download the latest version of Enhanced Ecommerce 1.7.0 or greater from www.magepal.com account.


#### Why use our Google Tag Manager extension?
Adding Google Tag Manager code snippet to the header section of your Magento / Adobe Commerce store may seem like the ideal, 
and most efficient way to add GTM to your site. But this will not be sufficient and limit your ability to take 
full advantage of GTM when integrating third-parties tracking codes that require data from your Magento stores, 
such as product name, price, items added to cart, order items, total, shipping amount or any other data. Our extension 
provides hundreds of data elements and events to accomplish any integration and provides the building block to make 
your next integration a success. With a few lines of code, you can quickly extend our extension to accomplish your 
most challenging integration. Google Tag Manager is only as powerful as the data layer powering it.
Learn more about [customizing Google Tag Manger](https://www.magepal.com/help/docs/google-tag-manager-for-magento/#api). 

#### Google Analytics 4
Upgrade to the next generation of tracking from Google. [Google Analytics 4](https://www.magepal.com/google-analytics-4-for-google-tag-manager.html?utm_source=ga4%20for%20Google%20Tag%20Manager&utm_medium=github) comes with a bunch of key features that make it very different and more powerful than Enhanced Ecommerce.
Gain access to GA4 new approach to privacy-first tracking, channel measurement, and AI based predictive data with MagePal Google Analytics 4 Extension.

#### Google Analytics Enhanced E-commerce
Want to track more? Upgrade to our new [Enhanced E-commerce for Google Tag Manager](https://www.magepal.com/enhanced-ecommerce-for-google-tag-manager.html?utm_source=Enhanced%20Ecommerce%20for%20Google%20Tag%20Manager&utm_medium=github) to take full advantage of Google Analytics most powerful e-commerce features. 
Gain valuable insight and increase your conversion rate by leveraging Google Enhanced Ecommerce to better understand your user actions and behaviors.

Learn more about our [Google Enhanced Ecommerce](https://www.magepal.com/enhanced-ecommerce-for-google-tag-manager.html?utm_source=Enhanced%20Ecommerce%20for%20Google%20Tag%20Manager&utm_medium=github) extension today. A small increase in your store’s conversion rate can make a giant impact on your revenue.

#### Third Party Integration with Google Tag Manager
Adding Facebook pixel, Bing UAT, SnapChat or any other third-party code snippet to your website but frustrated by
all the hassle and time it takes to configure Google Tag Manager? Learn how simple and easy it is to integrate any 
tracking code to your Magento store with our new [DataLayer extension](https://www.magepal.com/datalayer-for-google-tag-manager.html?utm_source=data%20layer%20for%20Google%20Tag%20Manager&utm_medium=github).

_(README truncated for .md surface. Full README on https://packagento.com/magepal/magento2-googletagmanager.)_

## Recent Versions

| Version | Released |
|---|---|
| 3.0.2 | 2026-05-15 |
| 3.0.1 | 2025-04-16 |
| 3.0.0 | 2024-08-06 |
| 2.7.8 | 2024-04-30 |
| 2.7.7 | 2024-04-17 |
| 2.7.6 | 2024-04-04 |
| 2.7.5 | 2024-01-25 |
| 2.7.4 | 2023-06-06 |
| 2.7.3 | 2023-03-17 |
| 2.7.2 | 2023-03-14 |

Showing 10 of 49 versions. Full release history on https://packagento.com/magepal/magento2-googletagmanager.

## Dependencies

### Require

| Package | Constraint |
|---|---|
| magento/framework | 103.0.* |
| magento/module-backend | 102.0.* |
| magepal/magento2-core | >=1.1.14 |
| php | ~8.3.0\|~8.4.0\|~8.5.0 |

### Suggest

| Package | Constraint |
|---|---|
| magepal/magento2-enhanced-ecommerce | Get more from Google Tag Manager with Enhanced E-commerce. Learn more at https://www.magepal.com/enhanced-ecommerce-for-google-tag-manager.html |
| magepal/magento2-google-analytics4 | Prepare for the future with Google Analytics 4. Learn more at https://www.magepal.com/google-analytics-4-for-google-tag-manager.html |

## Quality

Latest release (3.0.2) fails the Packagento QA pipeline. Verdicts below are per-cell (Magento line × PHP version) for the matrixed tools, and run-once for the static / security tiers.


### Compatibility

Each Magento line is installed on its supported PHP versions, then the module is built (DI compile + static-content deploy). Cells show passed / failed / untested; staircase gaps render as `–`.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | not tested | Pass | – | – |
| 2.4.8 | – | Pass | Pass | – |
| 2.4.9 | – | – | Pass | Pass |


### Code Quality

Advisory checks against the module's source. Never affect the Compatibility verdict — a phpcs finding can't make a module incompatible.

#### Static Analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Warning | 56 | 56 warnings (ruleset: Magento2) — 3 auto-fixable with phpcbf |
| PHPMD | Warning | 9 | 9 rule violations (IfStatementAssignment:9) |
| Cpd | Pass | 0 |  |
| Composer validate | Info | 2 | valid; 2 advisory notes (composer validate --strict) |

#### PHPStan

Type-checks the module against a real Magento install. Re-runs per Magento + PHP version because resolvable symbols differ between releases.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | 4 | – | – |
| 2.4.8 | – | 4 | 4 | – |
| 2.4.9 | – | – | 4 | 4 |


### Tests

Unit and integration suites run per Magento + PHP cell. Test failures speak to the module's behaviour, not its compatibility with a line, so they're reported here separately.

#### Unit Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |

#### Integration Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |


### Security

Dependency-advisory audit (composer audit) plus a source malware scan. A malware detection fails the version outright.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| Composer audit | Pass | 0 |  |
| Malware scan | Pass | 0 |  |

## Licence and pricing

Free. A licence is still minted on checkout and bound to your project for Composer access — no payment step.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["magepal/magento2-googletagmanager"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

magepal is a Magento 2 vendor on Packagento. See https://packagento.com/magepal.md for their full catalogue.

