# magefan/module-google-tag-manager

> Magento 2 Google Tag Manager and Google Analytics 4

`composer require magefan/module-google-tag-manager`

Canonical URL: https://packagento.com/magefan/module-google-tag-manager

## At a glance

- **Vendor**: magefan (https://packagento.com/magefan.md)
- **Latest version**: 2.8.0 — released 2026-05-20
- **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/magefan/module-google-tag-manager 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 magefan/module-google-tag-manager:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

Magento 2 Google Tag Manager and Google Analytics 4

## README

[![Total Downloads](https://poser.pugx.org/magefan/module-google-tag-manager/downloads)](https://packagist.org/packages/magefan/module-google-tag-manager)
[![Latest Stable Version](https://poser.pugx.org/magefan/module-google-tag-manager/v/stable)](https://packagist.org/packages/magefan/module-google-tag-manager)

<img align="right" width="120" height="120" src="https://cm.magefan.com/catalog/product/cache/28b407cef1668fd0bdd6f36db3e8e2f0/i/c/icon-google-tag-manager.jpg">

[Magento 2 Google Tag Manager](https://magefan.com/magento-2-google-tag-manager)  extension is a solution for better and easier store performance tracking. It connects your store with Google Tag Manager, Google Analytics, and Google Ads, and requires only a few minutes for setup.

Enter your tracking IDs directly in the Magento admin panel and track every step customers take: from the moment they land on your website and up to the purchase.

Magefan Google Tag Manager extension for Magento is a low-effort solution that ensures you collect accurate data and make efficient decisions. 

<a href="https://magefan.com/blog/join-our-donations"><img  align="right" width="120" height="70" src="https://magefan.com/media/wysiwyg/made_in_ukraine.jpg"></a>

<a href="https://magefan.com/magento-2-google-tag-manager"><img width="190" height="70" src="https://cm.magefan.com/wysiwyg/products/download-magefan-extensions.png"></a>

### Do You Need a Google Tag Manager Extension in Magento?

As an eCommerce store owner, you have numerous decisions to make, and you have to ensure they are justified and bring real value. You cannot rely on trial and error here. You must have accurate data to back you up.

If you don’t want to edit the code manually and create all the tags and triggers yourself, you do need a dedicated Magento 2 extension to help you.  With the Google Tag Manager extension, you can:

* Set up Google Tag Manager, Google Analytics, and Google Ads in a few clicks.
* Track the most important eCommerce events without having to edit code.
* Concentrate on the data and reports instead of figuring out technicalities.

Magefan Google Tag Manager extension for Magento 2 can do just that. So, if you want to avoid the complications that manual setup usually brings, this tool is for you.

### Key features of the Magento 2 Google Tag Manager 

* Track 13+ eCommerce events
* Client-side and server-side tracking (Measurement Protocol/GTM server container)
* Ready-made datalayer with all tags, triggers, and variables
* Enhanced Conversions / Dynamic Remarketing
* GDPR and Google Consent Mode compliant
* Supports Google Tag Gateway
* No impact of the website speed
* Easy setup with no code editing
 
### Pricing of the Magento Google Tag Manager Extension
Magefan offers three different pricing options for Magento Google Tag Manager, including free GTM plan. Each plan offers different features and events based on the size or your store, numebr of events you want to track and tracking methods. Check some of the following features below.
  
<a href="https://magefan.com/magento-2-google-tag-manager/pricing">
          <img
            src="https://cm.magefan.com/wysiwyg/products/gtm-pricing-plans.png"
            alt="Editions and Pricing for Magento 2 Google Tag Manager" />
        </a>
        
### Benefits of the Magento Google Tag Manager
The Magento 2 Google Tag Manager extension creates an uncomplicated environment for data tracking and brings multiple benefits:

#### Implement tracking tags in a matter of minutes
Enabling Google Tag Manager tags usually requires you to insert the GTM tracking script into your website's source code manually. That’s way too tedious a task that takes longer than you’d like.

With the Google Tag Manager extension, you won’t have to do any of that.

Just enter the tracking IDs directly in the admin panel and generate the datalayer in one click. Then, import the GTM container with all the tags and triggers ready. 

No need to edit code and waste days setting up the events. We’ve got you fully covered.


<p align="center">
  <img width="853" height="425" src="https://cm.magefan.com/mf_webp/png/media/wysiwyg/products/gtm/set-up-google-tag-manager-in-magento.webp">
</p>

#### Monitor Every Customer Journey Step
Tracking customers’ behaviour is essential for detecting patterns and spotting bottlenecks. What seems insignificant may be a real dealbreaker, and you have to know where exactly things don’t go as expected.

With this Google Tag Manager extension for Magento, you get to track every step your customers take: from landing on your website to making a purchase or leaving your website without placing an order. 

This info gives you valuable insights into things that work and things that have to be optimized.


<p align="center">
  <img width="853" height="425" src="https://cm.magefan.com/mf_webp/png/media/wysiwyg/products/gtm/track-customer-journey-in-magento-2.webp">
</p>

#### Know Exactly What Your Top-Performing Products Are
What are your biggest traffic and revenue generators? What products do not perform as well as you expected? 

Use this Magento 2 Google Tag Manager extension to track what products get the most views, are purchased, added to the cart, wishlist, and removed from the cart the most often. 

Stop guessing and cut right to the chase. Establish a strategy that allows you to increase conversions and promote products that are falling behind in sales.

#### Track Every Single Purchase
Ad blockers, browser restrictions, and strict privacy settings often stand in the way of accurate data tracking. That’s where missing purchases start to seep in and disrupt the picture you have in Google Analytics.

This Magento 2 Google Tag Manager has a solution, though. Set up the server-side tracking using the Measurement Protocol or the GTM server container to not miss a single conversion.

_(README truncated for .md surface. Full README on https://packagento.com/magefan/module-google-tag-manager.)_

## Recent Versions

| Version | Released |
|---|---|
| 2.8.0 | 2026-05-20 |
| 2.7.4 | 2026-01-19 |
| 2.7.3 | 2025-10-16 |
| 2.7.2 | 2025-09-03 |
| 2.7.1 | 2025-08-12 |
| 2.7.0 | 2025-08-07 |
| 2.6.10 | 2025-06-19 |
| 2.6.9 | 2025-05-06 |
| 2.6.8 | 2025-04-22 |
| 2.6.7 | 2025-01-29 |

Showing 10 of 37 versions. Full release history on https://packagento.com/magefan/module-google-tag-manager.

## Dependencies

### Require

| Package | Constraint |
|---|---|
| magefan/module-community | >=2.3.5 |

## Quality

Latest release (2.8.0) 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 | Pass | 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 | 39 | 39 warnings (ruleset: Magento2) — 8 auto-fixable with phpcbf |
| PHPMD | Warning | 31 | 31 rule violations (UnusedFormalParameter:11, IfStatementAssignment:9, UndefinedVariable:4, EmptyCatchBlock:2, MissingImport:2) |
| 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 | 50 | 50 | – | – |
| 2.4.8 | – | 59 | 59 | – |
| 2.4.9 | – | – | 59 | 59 |


### 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=["magefan/module-google-tag-manager"],
  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

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

