Using the right Magento 2 extension is more essential now than ever. With MagePal, you can rest assured that you are getting the best quality Magento extensions, each line of code are carefully crafted and rigorously tested. Spend less time debugging and more time doing what you do best with MagePal extensions!
Enhanced Ecommerce provides useful metrics and reports that standard Google Analytics do not provide. These reports provide new insight on how your customer are interacting with your products by tracking product impressions, product detail views, add to cart actions, remove from cart actions, check out steps and items purchased. Our Magento 2 extension provide the necessary integration and data layer for Google Tag Manager so that you can quickly and easily add Enhanced E-Commerce to your Magento store.
Adding Facebook Pixel, Bing UET, or other third-party JavaScript to your site using Google Tag Manager? Learn how simple and easy it is to integrate any third party service with our new DataLayer extension.
Review license.txt
Install Google Tag Manager (version 3.0.0 or greater for Magento 2.4.0 and above)
composer require magepal/magento2-googletagmanager
Learn more about installing and setting up Google Tag Manager
Install Enhanced E-commerce for Google Tag Manager (version 2.0.0 or greater for Magento 2.4.0 and above)
Using Composer (recommended)
composer require magepal/magento2-enhanced-ecommerce
Using Hyvä Magento 2 Theme?
composer require hyva-themes/magento2-magepal-enhanced-ecommerce
Manually (not recommended)
Enable Module (from {Magento root} folder)
php -f bin/magento module:enable --clear-static-content MagePal_GoogleTagManager
php -f bin/magento module:enable --clear-static-content MagePal_EnhancedEcommerce
php -f bin/magento setup:upgrade
Log into your Magento 2 Admin
Like our extensions? Would you be kind enough to leave us a Google review? It only takes a minute and we’d be eternally grateful! Just click the link to go to our MagePal Google Business page and leave us your feedback.
The quickest way to configure your Google Tag Manager Container is to use our auto import JSON config import file for Google Tag Manager. Our configuration (.json) file is used to simplify the process, importing to generate a tag in your GTM container. For additional information, see Google’s Container export and import which provide walk-through on how to importing a sample JSON file to a new container. You can also manually configure our Enhanced eCommerce extension.
Add more information to the data layer to meet your client needs is as simple as adding few lines of php and di.xml code in your custom extension.
namespace MagePal\GoogleTagManagerAddons\DataLayer\OrderData;
/**
* Class OrderProvider
* @package MagePal\GoogleTagManager\DataLayer
* @method getItem()
* @method getOrder()
* @method getListType()
*/
class OrderProvider extends MagePal\GoogleTagManager\DataLayer\OrderData\OrderAbstract
{
/**
* @return array
*/
public function getData()
{
$data = [
'tax' => $this->getOrder()->getTax()
];
return $data;
}
}
di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagePal\GoogleTagManager\DataLayer\OrderData\OrderItemProvider">
<arguments>
<argument name="orderItemProviders" xsi:type="array">
<item name="order-item-provider-brand" xsi:type="object">MagePal\GoogleTagManagerAddons\DataLayer\OrderData\OrderProvider</item>
</argument>
</arguments>
</type>
</config>
Learn more about customizing our Google Tag Manager extension
$("body").on("mpCustomerSession", function (event, type, products, datalayer) {
});
/*
* @type AddToCart | RemoveFromCart
*/
$("body").on("mpCartItem", function (event, type, products) {
});
$("body").on("mpCheckout", function (event, index, title, code, products) {
});
$("body").on("mpCheckoutOption", function (event, step, checkoutOption) {
});
$("body").on("mpProductClick", function (event, product) {
});
$("body").on("mpCheckoutShippingStepValidation", function (event, isFormValid, errors) {
});
$("body").on("mpCheckoutPaymentStepValidation", function (event, data) {
data.isValid (bool)
data.errorMsg (array)
});
$("body").on("mpCheckoutEmailValidation", function (event, emailExist) {
});
In addition to all of the standard data elements provided by our Google Tag Manager extension, our Enhanced E-commerce extension include additional data layer element.
Even the most advanced Google Tag Manager users often run into issues while setting up new tags. Frustrated by the process we often ask ourselves, why doesn’t my tag fire, what data is sending to Google Analytics and why didn’t this trigger work?
One of the most overlooked, yet important steps while working with GTM is its preview and debugging mode. Google Tag Manager’s preview mode allows you to preview your container code as if the current container draft was deployed so that you can test your configuration before it is published.
For general debugging information see how to debug Google Tag Manager
Unlike other Enhanced Ecommerce extensions that add hundreds of lines of JavaScript to your site, our extension was designed to minimize the amount of code injected in your site. Our extension was design to use Magento HTML and CSS classname to function correctly. In rear situation third party themes, extensions or developers my change the default Magento structure which cause our extension to not fire all events. Fixing this is as simple as remapping your site HTML structure in our extension.
In Chrome or any other browser, go to your Elements
tabs and find the item collection elements.
li
or div
You can quickly test your selector you run the code below in your browser’s console.
//should return each product link
jQuery('.products-grid .product-item a[class*="product-item-"]')
//should return the parent container for each item
jQuery('.products-grid .product-item')
Minification is the process of removing all unnecessary characters and spacing from your source code without changing its functionality.
Add cross-sell, upsell, related products, social media links and other elements to your order confirmation.
Get more from your order confirmation emails by promoting other complementary products.
Total Downloads
years experience with Magento
Magento / Adobe Commerce Extensions
With millions of downloads worldwide, install with confidence knowing that our extensions will just work.
Is your Magento store ready for the future? Say hello to the new Google Analytics 4, which is built from the ground up with all-new features and advanced machine learning technology.