Yireo - Trainings & extensions

Open main menu

Magento 1 Extension


Add GoogleTagManager to Magento 1 including the e-commerce dataLayer

  • 100% open source and well-written
  • compliant with modern Magento standards
  • Free with no strings attached
  • Community collaboration via GitHub

Latest release: 1.6.3

This extension is also listed on GitHub:

Sponsor our open-source efforts via GitHub

Usage after installation


Login to your Google Tag Manager account. Follow the Google instructions to create a new Google Tag Manager container. Extract the Container Public ID from your new container. Configure your new ID in Magento through System> Configuration> [Services] Google Tag Manager.


The extension has the following configuration options:

  • Enabled: When this is set to No, the extension does not work.
  • Container Public ID: The ID of your Google Tags container
  • Insertion Method: A technical thing which is either set to Observer or to XML Layout. If the one does not work for you, try the other one instead.
  • Debug: For developers.

Data layer attributes

This extension adds the following attributes automatically to the data layer. There is no backend option to tune this, so if you want to make changes, change the PHTML templates in your own theme.

  • customerLoggedIn = Whether the customer has logged in
  • customerId = ID of the customer
  • customerGroupId = Customer group ID
  • customerGroupCode = Customer group code
  • categoryId = Category ID
  • categoryName = Category name
  • categoryProducts = Listing of top 3 products
  • productId = Product ID
  • productName = Product name
  • productSku = Product SKU
  • productPrice = Product price
  • transactionId = Order ID
  • transactionDate = Order date
  • transactionAffiliation = Website name
  • transactionTotal = Order total
  • transactionTax = Order tax
  • transactionShipping = Shipping amount
  • transactionPayment = Payment method
  • transactionCurrency = Currency of website
  • transactionPromoCode = Promotional code used for order
  • transactionProducts = Listing of all
    • sku = Item SKU
    • name = Item name
    • price = Item price
    • category = Listing of category IDs
    • quantity = Item quantity

Note that on a product page with an URL that also identifies a category, both the product attributes and the category attributes are added.

Technical details

This module does not use XML rewrites to change core classes. It uses two insertion modes - one using the XML layout, one using an observed event core_block_abstract_to_html_after.


When you want to track conversions in your Magento checkout, our extension helps out as well: It adds the relevant information to all your checkout and cart pages. Do you want to know which variables are on the success page? Use the Yireo CheckoutTester extension to preview that page and view its HTML source.

Bring your towel.

Quick Start to install your Yireo extension

Installation via composer URL

We recommend to install Magento 1 extensions via composer. See the Composer project for instructions on how to get composer up and running. Once composer is installed, use the following command to install our extension.

composer require yireo/magento1-googletagmanager

After this, the extension is ready for use in Magento. First of all, flush the cache. This can be either done using the Cache Management page in the Magento Admin Panel, or by using the command magerun cache:flush. If you were already logged into the Magento Admin Panel, make sure to logout and log back in again, before proceeding. Do not forget to grab yourself a manual copy of our extension as a backup.

Manual installation

Please note that we highly recommend using composer instead. However, in some cases, it might be required to do a non-composer installation. For this, download the module ZIP from our site (under the tab File Downloads). Next, create a folder with the following name and copy to the ZIP contents to it:


After this, the extension is ready for use in Magento. First of all, flush the cache. This can be either done using the Cache Management page in the Magento Admin Panel, or by using the command magerun cache:flush. If you were already logged into the Magento Admin Panel, make sure to logout and log back in again, before proceeding. Do not forget to grab yourself a manual copy of our extension as a backup.


Head over to the GitHub repository for downloads: https://github.com/yireo/Yireo_GoogleTagManager

Frequently Asked Questions

No, it is not. As a policy, all our Yireo software is unencrypted - we do not make use of technologies like ionCube or ZendOptimizer. All PHP-code is open source, but for commercial extensions the code is only given to paying customers.

You probably would like to know if this extension is working under a specific Magento version 2.X.Y. However, from a technical point of view, the question is wrong: The major Magento version 2.X.Y is not semantical but instead used for marketing purposes. It doesn't give any guarantees.

Instead, we maintain compatibility with the actual modules that lie underneath (like Magento_Catalog or the Magento Framework). And version management for these dependencies is handled via composer. We strongly advice you to rely on composer to answer the question whether our extension works under a specific Magento version. This is the only way to guarantee compatibility in a professional way.

Alternatively, study our CHANGELOG for details on the progress we made.

This extension is offered for free. Feel free to go the GitHub repository (see the link under Quick Start> Downloads) and open an Issue there. Please note that this is a voluntary open source project. The more helpful you are in describing the issue at hand, the more likely volunteers can come in to help you with the issue.

Yes, it does. The module pushes useful information to various parts of the GTM data layer. However, to track all possible information, various JavaScript events need to be added to numerous places of your Magento theme. For instance, product clicks (onclick="dataLayer.push({'event': 'productClick'});") need to be added everywhere where your Magento theme contains a product link. Because this would replace 99% of all your current theme, and this would increase problems dramatically, we have choosen to add all the elements of the data layer, but you will need to add the events manually to your code.

If you want to hire us for adding these events, please let us know. If you want to customize things yourself, make sure to check the comments in the PHTML templates of our extension.

This is correct. With our module, PHTML templates are not used to generate the actual HTML and JavaScript code. Instead, they allow you to tune PHP arrays that will be converted automatically into the right JSON data that will be passed onto the GTM data layer. Using PHTML templates, you have the benefit of theme inheritance. The PHP arrays are simple and it should be easy to customize them, provided you have the right knowledge of PHP.

Getting support

If you run into problems, we are happy to help you out with the following resources:

We usually respond within 24 hours.


This module requires PHP 7. This means that you also need to have at least Magento or higher.

End-of-Life of Magento 1

Note that the End-of-Life of Magento 1 is approaching and after that time, this extension will be abondoned. As of yet, this extension is still active but marked as deprecated: You should be using Magento 2 or planning a migration to Magento 2 or something else.

Supported Magento versions

  • (see composer requirements)
The supported PHP versions equal the versions supported by Magento itself

Requirement details

  • php: >=7.0.0


All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.


[1.6.2] - 2019-05-22

  • Calculated price with taxes in order
  • Calculated price with taxes in quote

[1.6.1] - 2019-05-21

  • Calculated price for Configurable Product options

[1.6.0] - 2019-05-18

  • Fix product pricing with incl, excl and tax
  • Fix pricing of child products of Configurable Products
  • Refactoring of all price-related data
  • Remove empty values from dataLayer
  • formatPrice method signature uses only 1 parameter [@Lex50]
  • Add child products to data of Grouped Product
  • Add a debugger to footer while debugging
  • Implement KeepAChangeLog

Note on previous releases

Previous releases are not included in this CHANGELOG but messages can be found in git.


We are a proud member of ExtDN

ExtDN forms a network of Magento extension developers, that strive for a better extension quality - both on a technical level and from an end-users point of view. With industry leaders like Fooman and aHeadworks, ExtDN lifts up the Magento extension space to a new level. And Yireo is proud to be part of this.

Do not miss out on what we say

This will be the most interesting spam you've ever read

We don't write too commercial stuff, we focus on the technology (which we love) and we regularly come up with innovative solutions. Via our newsletter, you can keep yourself up to date on all of this coolness. Subscribing only takes seconds.

Sign up for the Yireo newsletter


Legal information

Other Yireo sites

Get Social

About Yireo