Table of Contents
Google Tag Manager User Guide for Magento 2
Extension Overview
This user guide provides comprehensive documentation for the Towering Media Magento 2 Google Tag Manager Extension. It helps merchants, store administrators, and developers install, configure, and use the extension to integrate Google Tag Manager with Magento 2.
The extension provides GA4-compatible dataLayer tracking for Magento storefront events and supports accurate tracking for Google Analytics 4, Google Ads, remarketing, and other marketing platforms.
Overview
The Towering Media Google Tag Manager Extension for Magento 2 provides a reliable integration with Google Tag Manager without modifying Magento core files.
The extension automatically injects the GTM container into the storefront and generates a clean, structured GA4-compatible dataLayer.
It supports tracking for:
* Product impressions * Product detail views * Product selection * Add to cart * Remove from cart * Shopping cart view * Checkout start * Completed purchases * Google Ads conversion tracking * Dynamic remarketing * Enhanced Conversions * Cookie consent integration * Server-side tracking
The extension is compatible with Magento 2.4.x, Hyvä Theme, Luma Theme, Full Page Cache, Varnish, and LiteSpeed environments.
Installation
Please refer to the official Towering Media Installation Guide for installing, upgrading, and uninstalling the extension.
Installation Guide:
Store Configuration
After installing the extension, configure it from Magento Admin.
Navigation:
Stores → Configuration → Towering Media → Google Tag Manager (Hyvä)
General
| Configuration | Description |
|---|---|
| Enable | Enables or disables the Google Tag Manager extension. |
| GTM Container ID | Enter your Google Tag Manager Container ID, for example GTM-XXXXXXX. |
| GA4 Measurement ID | Enter your Google Analytics 4 Measurement ID, for example G-XXXXXXXXXX. |
| Defer GTM Loading | Defers loading of the GTM script until after the first user interaction to improve page performance. |
Product Tracking
| Configuration | Description |
|---|---|
| Product Identifier | Select the identifier used in tracking events. SKU is recommended. |
| Enable Brand Tracking | Includes the product brand in product events. |
| Enable Variant Tracking | Includes variant information for configurable, grouped, and bundle products. |
| Include All Assigned Categories | Includes every assigned category in the dataLayer. |
Transaction Settings
| Configuration | Description |
|---|---|
| Exclude Tax From Purchase Transaction | Excludes tax from purchase values. |
| Exclude Tax From Other Events | Excludes tax from product-related events. |
| Exclude Shipping From Purchase Transaction | Excludes shipping from purchase values. |
Custom Dimensions
| Configuration | Description |
|---|---|
| Enable Custom Dimensions | Enables GA4 custom dimensions. |
| Include Order ID in Events | Adds the Magento Order ID to purchase events. |
| Include Page Name in Events | Adds the page name as a custom dimension. |
| Include Page Type in Events | Adds the Magento page type as a custom dimension. |
| Track Product Reviews | Includes review count and rating in product events. |
| Item Scoped Custom Dimension Attributes | Select Magento product attributes to include as item-scoped custom dimensions. |
Cookie Consent Integration
| Configuration | Description |
|---|---|
| Enable Cookie Consent Integration | Loads GTM only after the required consent is granted. |
| Cookie Consent Manager | Select the cookie consent platform. |
| Required Consent Categories | Specify the consent categories required before GTM loads. |
| Enable Google Consent Mode V2 | Enables Google Consent Mode V2. |
Server-Side Tracking
| Configuration | Description |
|---|---|
| Enable Measurement Protocol | Sends events directly to GA4 using the Measurement Protocol API. |
| GTM Server Container URL | Specify the Server-Side GTM container URL. |
Google Ads Integration
| Configuration | Description |
|---|---|
| Enable Google Ads Conversion Tracking | Enables Google Ads conversion tracking. |
| Google Ads Conversion ID | Enter your Google Ads Conversion ID. |
| Conversion Label | Enter the Google Ads conversion label. |
| Enable Dynamic Remarketing | Enables dynamic remarketing data. |
| Enable Enhanced Conversions | Enables Enhanced Conversions for Google Ads. |
Third-Party Integrations
| Configuration | Description |
|---|---|
| Overview | Configure additional third-party integrations supported by the extension. |
Debug Mode
| Configuration | Description |
|---|---|
| Overview | Enable debugging to validate GTM events and dataLayer output. |
Export
| Configuration | Description |
|---|---|
| Generate and Download JSON for GTM Import | Downloads a ready-to-import GTM container JSON. |
| Download GTM Tags CSV | Downloads a CSV containing GTM events and parameters. |
<note> After updating any configuration, click Save Config, clear the Magento cache if necessary, and publish your updated Google Tag Manager container. </note>
Validation Checklist
After configuring the extension and publishing your Google Tag Manager container, use the following checklist.
| Validation Item | Expected Result | Status |
|---|---|---|
| Extension is enabled | Extension is enabled in Stores → Configuration → Towering Media → Google Tag Manager (Hyvä). | ☐ |
| GTM Container ID | Correct GTM Container ID is configured. | ☐ |
| GA4 Measurement ID | Valid GA4 Measurement ID is configured. | ☐ |
| GTM Script Loaded | Google Tag Manager script loads successfully on storefront pages. | ☐ |
| GTM Container Published | Latest GTM container version is published. | ☐ |
| Data Layer Available | window.dataLayer is available. | ☐ |
| Product View Event | view_item event is triggered. | ☐ |
| Category View Event | view_item_list event is triggered. | ☐ |
| Product Selection Event | select_item event is triggered. | ☐ |
| Add to Cart Event | add_to_cart event is triggered. | ☐ |
| Remove from Cart Event | remove_from_cart event is triggered. | ☐ |
| Checkout Event | begin_checkout event is triggered. | ☐ |
| Purchase Event | purchase event is triggered once after successful checkout. | ☐ |
| Product Data | Product ID, SKU, name, category, price, and quantity are present. | ☐ |
| Transaction Data | Order ID, revenue, tax, shipping, coupon, and currency are included. | ☐ |
| Google Analytics 4 | Events appear in GA4 DebugView. | ☐ |
| Google Ads | Conversion tracking is working if enabled. | ☐ |
| Dynamic Remarketing | Remarketing data is available if enabled. | ☐ |
| Enhanced Conversions | Enhanced Conversions are working if enabled. | ☐ |
| Cookie Consent | GTM loads after required consent is granted. | ☐ |
| Google Consent Mode V2 | Consent signals are updated correctly. | ☐ |
| Server-Side Tracking | Events are forwarded to the server container if enabled. | ☐ |
| No JavaScript Errors | No GTM or dataLayer errors in browser console. | ☐ |
| Performance | GTM loads without impacting performance. | ☐ |
Recommended Validation Tools
* Google Tag Manager Preview / Tag Assistant * Google Analytics 4 DebugView * Browser Developer Tools * Google Ads Diagnostics * Browser Network Tab
Expected eCommerce Events
The extension supports the following GA4-compatible eCommerce events:
* view_item_list * select_item * view_item * add_to_cart * remove_from_cart * view_cart * begin_checkout * purchase
User Experience
The Google Tag Manager extension automatically pushes GA4-compatible eCommerce events throughout the customer shopping journey. Each event contains structured product and transaction data in the dataLayer.
Category Page – view_item_list
When a customer opens a category page, the extension pushes the view_item_list event containing the products displayed in the listing.
Product Page – view_item
Opening a product detail page triggers the view_item event with product information such as product ID, name, category, currency, and price.
Add to Cart – add_to_cart
When a product is added to the shopping cart, the add_to_cart event is triggered with the selected product and quantity.
Shopping Cart – view_cart
Viewing the shopping cart triggers the view_cart event containing all cart items and the current cart value.
Checkout – begin_checkout
Order Success – purchase
After a successful order, the purchase event is fired once with transaction ID, revenue, currency, tax, shipping, and purchased items.
Final Verification
Before considering the implementation complete, verify the following:
* GTM container has been published. * Magento cache has been cleared after configuration changes. * Events fire only once. * Revenue values match between Magento, GA4, and Google Ads. * No duplicate purchase events are recorded. * All required marketing tags are firing correctly.
Troubleshooting
| Issue | Possible Cause | Resolution |
|---|---|---|
| GTM script is not loading | Extension is disabled or GTM Container ID is incorrect. | Enable the extension, verify the GTM Container ID, save the configuration, and clear Magento cache. |
| No dataLayer events are generated | JavaScript errors, theme conflicts, or GTM loading is blocked. | Check browser console, inspect window.dataLayer, and verify theme compatibility. |
| Events do not appear in GA4 DebugView | Incorrect GA4 Measurement ID or unpublished GTM container. | Verify the GA4 Measurement ID, publish the GTM container, and test using GTM Preview mode. |
| Purchase event is missing | Order success page was not reached or GTM configuration is incomplete. | Complete a test order and verify the purchase event fires only on the success page. |
| Duplicate purchase events | Multiple GTM tags or duplicate purchase triggers. | Review GTM triggers and ensure only one purchase tag is configured. |
| Google Ads conversions are not recorded | Conversion ID or Conversion Label is incorrect. | Verify the Google Ads Conversion ID and Conversion Label settings. |
| Cookie consent prevents tracking | Required consent has not been granted. | Review the cookie consent configuration and grant the required consent categories. |
| Server-side tracking is not working | Measurement Protocol or Server Container URL is incorrect. | Verify the Measurement Protocol configuration and the GTM Server Container URL. |
| Incorrect revenue values | Tax or shipping exclusion settings are misconfigured. | Review Transaction Settings and ensure configured values match reporting requirements. |
| Configuration changes are not visible | Magento cache has not been refreshed. | Save the configuration, clear Magento cache, and redeploy static content if required. |
Additional Support
If the issue persists after completing the above checks, validate the implementation using:
* Google Tag Manager Preview / Tag Assistant * GA4 DebugView * Browser Developer Tools
When contacting Towering Media Support, include:
* Magento version * Extension version * GTM Container ID * Relevant error messages * Screenshots, if available






