Professional B2B System for Magento 2 Open Source
€750.00 €750.00
Kowal Data Layer is a Magento 2 module that streamlines data layer implementation for Google Analytics 4 and Google Tag Manager. Instead of manually adding scripts to the theme, checkout, and product pages, the module generates consistent dataLayer events directly from Magento data.
The module was designed for production stores: it supports per-store-view configuration, multistore and multilanguage installations, and analytics errors do not block sales. If a payload cannot be built, the add-to-cart, checkout, or payment process continues, and the details are written to a dedicated log.
The module is intended for Magento 2 stores that want to implement or organize GA4 ecommerce analytics through Google Tag Manager. It is especially suitable where the accuracy of product, cart, and transaction data has a direct impact on advertising campaigns, remarketing, and sales reporting.
item_id, so product identifiers can match advertising feeds.Kowal Cookie Consent and Consent Mode.var/log/kowal_datalayer.log.user_dataview_item_listselect_itemview_itemadd_to_cartremove_from_cartview_cartadd_to_wishlistbegin_checkoutadd_shipping_infoadd_payment_infopurchasepurchase_testThe module clears the previous ecommerce object before ecommerce events, enforces numeric types for price, quantity, value, tax, and shipping, limits product lists to a maximum of 200 items, and helps maintain a consistent item_id throughout the entire purchase journey.
Product list events carry item_list_id, item_list_name, and index, so product clicks and add-to-cart actions from lists retain their source context.
A correct data layer is the foundation of effective analytics and advertising campaigns. Kowal Data Layer reduces the risk of inconsistent product identifiers, incorrect data types, duplicate transactions, and uncontrolled scripts in the theme. The module gives administrators control over data mapping and gives developers a predictable, secure event mechanism.
If the store uses the Kowal Cookie Consent module, Kowal Data Layer can work alongside it without duplicating Google Tag Manager. Cookie Consent remains the owner of consents and GTM, while Data Layer is responsible for sending correct ecommerce events.
purchase_test and online paymentsThe module supports an intermediate purchase_test page for payments that require sending a test event before redirecting the customer outside the store. In the configuration, you can specify payment methods and choose the redirect mode: static URL, URL pattern, or adapter.
For gateways that generate a dynamic transaction URL, for example with an order token, adapter mode should be used. This is a safe extension approach: the module keeps a stable purchase_test mechanism, while a dedicated adapter is responsible only for retrieving the correct payment operator URL.
An analytics module should never be a critical part of the purchase process. That is why Kowal Data Layer captures PHP and JavaScript errors, logs the technical context, and allows Magento to continue sales without interrupting the cart, checkout, order placement, or payment redirection.
kowal/base module.Kowal_CookieConsent, if the store uses it for GTM and Consent Mode.composer config repositories.kowal-datalayer vcs composer require kowal/module-datalayerphp bin/magento module:enable Kowal_DataLayerphp bin/magento setup:upgradephp bin/magento cache:flush In a production environment, if required by the project, perform the standard Magento deployment:
php bin/magento setup:di:compilephp bin/magento setup:static-content:deployphp bin/magento cache:flushAdmin panel:
Stores > Configuration > Kowal > Kowal Data Layer
Menu:
kowal.store > Modules > Data Layer > Settings
Enable Module - enable the module for the selected configuration scope.Debug Mode - enable only during testing and implementation verification.Render Mode - keep Server and JavaScript unless there is a reason to limit the operating mode.Missing Value Strategy - choose whether missing values should be skipped or sent as undefined.Clear Ecommerce Before Push - recommended Yes.Fail-safe Mode - recommended Yes; sales-critical processes remain protected even after this option is disabled.Log Level - on production, Errors only is recommended.Log Payloads - enable only temporarily.Product Identifier Attribute - choose the attribute used as item_id. Default: sku.Brand Attribute - choose the manufacturer/brand attribute. Default: manufacturer.Category Strategy - choose the method for building item_category.Category Attribute - set only if the category strategy uses a product attribute.Configurable Product Strategy - decide whether to use child/simple or parent/configurable data.Include Out Of Stock Products On Lists - applies to product list events.Enable the events required by the implementation:
user_dataview_item_listselect_itemview_itemadd_to_cartremove_from_cartview_cartadd_to_wishlistbegin_checkoutadd_shipping_infoadd_payment_infopurchasepurchase_test, if the store uses an intermediate page before payment.Send User ID - sends the Magento customer ID for logged-in customers.Send Hashed Email - sends only the SHA-256 hash of the email. The raw email is not sent to dataLayer.Integrate With Kowal Cookie Consent - enable if the store uses Kowal_CookieConsent.Render GTM From DataLayer Module - leave No if GTM is already rendered by Cookie Consent or another module.Google Tag Manager ID - set only if GTM rendering from this module is enabled.purchase_test Redirect Rules - add only those payment methods that should use the purchase_test intermediate page.purchase_test rule modes:
Static URL - use only for payments with a fixed operator address.URL Pattern - use when a URL pattern with placeholders {order_id}, {order_increment_id}, {store_id}, or {quote_id} is sufficient.Adapter Required - use for gateways that generate a dynamic transaction URL. Before launching on production, a dedicated adapter must be added for the specific payment module.Configure the module at the store view level if the stores differ in:
dataLayer in the browser console or with the DataLayer Checker extension.view_item event.view_item_list.select_item.add_to_cart.remove_from_cart.add_to_wishlist.view_cart and begin_checkout.add_shipping_info and add_payment_info.purchase.purchase is not duplicated.var/log/kowal_datalayer.log.purchase_test integrationIf the payment method redirects the customer outside the store and knows the target operator URL, the payment integration can use:
Kowal\DataLayer\Model\PurchaseTestRedirect::prepare($paymentRedirectUrl)The method returns the module intermediate page URL. The intermediate page sends purchase_test and then redirects the customer to the payment operator. If JavaScript or DataLayer does not work, the redirect should still be performed.
For an integration where the URL depends on the order or transaction token, use:
Kowal\DataLayer\Model\PurchaseTestRedirect::prepareForOrder($order, $fallbackRedirectUrl)If the method is set to Adapter Required mode, the adapter should implement:
Kowal\DataLayer\Api\PurchaseTestRedirectAdapterInterfaceThe adapter should be registered in DI as an array item in adapters for Kowal\DataLayer\Model\PurchaseTest\RedirectAdapterPool. The adapter is the proper place for logic that depends on a specific payment operator.