Google Tag Manager

Google Tag Manager

  • Integrate GTM into Magento
  • Support for e-commerce tags
  • Easy to extend and modify

This Magento extension adds Google Tag Manager to your Magento site, allowing you to manage all your Google tags (Adwords, Analytics) centrally through the Google Tag Manager site.

Cost Free
Current version 1.5.0 (Stable)
Requirements Magento CE 1.7 - 1.9
Magento EE 1.10 - 1.14
PHP 5.5.0 or higher (5.5, 5.6, 7.0, 7.1)
Download Download
Support Support Forum
License GNU/GPL (General Public License)

Features

  • Implement Google Tag Manager in Magento quickly
  • Handle all your script-tags through the Google Tag Manager site
  • Automatic addition to all product-pages
  • Easy styling through Magento backend options
  • Quick and easy setup
  • Easily add extra vars to dataLayer via PHTML-templates per page-type
  • Optional PHP-code allows for further integration (category-pages)
  • Insert via observer or via XML layout

Screenshots

Want to see Google Tag Manager in action?

See screenshots

Steps to get it working

  • Login to the MagentoConnect Manager of your own website
  • Install the extension using the MagentoConnect extension key or the manual download on our site
  • 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 (see screenshot below)
  • Configure your new ID in Magento through System > Configuration > [Services] Google Tag Manager

Tip

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 our Checkout Tester extension to preview that page and view its HTML source.

Magento 2 extension available

Please note that this extension is only available under Magento 1 (which is by now a deprecated platform that you should move away from). We have released a new extension for Magento 2, which is listed on our extensions page.

Usage

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.

  • Generic
    • pageType = Original page route (module/controller/action)
  • Customer
    • customerLoggedIn = Whether the customer has logged in
    • customerId = ID of the customer
    • customerGroupId = Customer group ID
    • customerGroupCode = Customer group code
  • Category
    • categoryId = Category ID
    • categoryName = Category name
    • categoryProducts = Listing of top 3 products
  • Product
    • productId = Product ID
    • productName = Product name
    • productSku = Product SKU
    • productPrice = Product price
  • Order (only the single last order, and only if no quote available)
    • 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 items in cart
      • sku = Item SKU
      • name = Item name
      • price = Item price
      • category = Listing of category IDs
      • quantity = Item quantity
  • Quote (current shopping cart)
    • Same as with order, except without shipping and payment

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.

Frequently Asked Questions

Does this module support Enhanced Ecommerce (UA)?

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.

I don't see any JavaScript or HTML in your PHTML templates

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.

More extensions

TrashCan

TrashCan

Restore Magento products once deleted by accident