Magento 1 / OpenMage GA4 Google Tag Manager (GTM)
Installation and User Guide for Magento 1 / OpenMage GA4 Google Tag Manager (GTM)
Table of Contents
- Installation
- Disable Compilation Mode
- Upload Package
- Clear Caches
- Configuration Settings for Google Tag Manager Pro Tracking
- General Settings
- Query String Parameter Cookies
- JSONs provided with extension package
- Google Analytics 4
- Facebook Pixel Tracking
- Snapchat Pixel Tracking
- Adwords Dynamic Remarketing
- Google Ads Enhanced Conversion Tracking with Javascript variable
- Google Ads Enhanced Conversion Tracking with Data layer
- Microsoft UET Tracking (Bing Ads Tracking)
- Tiktok Pixel Tracking
- Twitter(X) Pixel Tracking
- Reddit Pixel Tracking
- Importing JSONs into GTM
- Setting variable information in GTM
- Publishing Tags in GTM
- Set up Google Analytics 4
- AJAX Add to Basket or Remove from Basket
- AJAX Add to Basket
- AJAX Remove from Basket
- Set Primary Categories
- Upgrading the Module From 0.0.35 and Below
- Query String Parameter Cookies
Installation
- Disable Compilation Mode: To check that this is disabled, go to System>Tools > Compilation. If the compiler status is 'Disabled', you are ready to go. If not, simply click the 'Disable' button on the right hand side of the screen.
- Upload Package: Upload the content of the module to your root folder. This will not overwrite the existing Magento folder or files, only the new contents will be added.
- Clear Caches: This can be done from the admin console by navigating to the cache management page (System > Cache Management), selecting all caches, clicking 'refresh' from the drop-down menu, and submitting the change.
Configuration Settings for Google Tag Manager Pro Tracking
Go to Admin > Stores > Configuration > Scommerce Configuration > Google Tag Manager Pro Tracking
General Settings
- Enabled – Select “Yes” or “No” to enable or disable the module.
- License Key – Please add the license for the extension which is provided in the order confirmation email. Please note license keys are site URL specific. If you require license keys for dev/staging sites then please email us at support@scommerce-mage.com
- Container Id – Enter your Google Tag Manager Container Id.
- Server Side Tagging - This setting allows you to enable or disable server-side tagging, which is a method that shifts part of the tag processing and data sending workload from the user's device to a server that you control.
Please don’t turn this on unless you understand what this setting does.
- GTM code HTML - This setting allows you to enter the HTML code of server-side GTM container. This HTML code will replace the default GTM code on the frontend of your website.
GTM noscript HTML - This setting allows you to enter noscript part of server-side GTM code. This noscript code will replace the default noscript GTM on the frontend of your website.
- Enhanced Conversion – Set “yes” to enable the enhanced conversion and send PII data with the tag. Please make sure enhanced conversion is enabled in Google Ads before using this setting.
- Brand Attribute – Select brand attribute to send brand information to Google Analytics.
- Brand text box – If you don’t have brand attribute and you want to send default brand name to Google Analytics then you can enter here.
- Base – Set “Yes” if you want to send base order data and ‘No’ to send store order data to Google. Set this to “Yes” always unless you have multi- store/currency is enabled and you want to send different currency data to Google.
Revenue without Shipping Price –Set “yes” to send revenue data without the shipping amount.Send Phone or Admin Orders –Enable this feature only if you want to send admin orders on order creation.Send Refund on Order Cancellation –Enable this feature to send refund event when an order is cancelled from admin.Source –Add source you want to pass to Google for admin orders.Medium –Add medium you want to pass to Google for admin orders.Enable dynamic remarketing tags and facebook tracking –Set yes to enable dynamic remarketing tags and facebook tracking.Product ID Attribute –Select attribute for Product ID, this should be same attribute as you have in your Google Base Feed.








- Overwriting the existing container will remove all your existing tags, triggers, and variables, and will replace them with those in the imported container. A new container version will be created before the import.
- Merging containers will let you keep your existing tags, triggers, and variables, and just add in the new ones. If you choose to Merge the new container with your existing container, you’ll have to then decide whether you want to overwrite conflicting tags or rename conflicting tags.
Overwrite – If a variable, tag, or trigger in the new container has the same name but the contents are different, overwrite the old one with the new one.
Rename – If a variable, tag, or trigger in the new container has the same name but the contents are different, keep the old one and rename the new one.
Click Continue. You’ll see a preview of changes, showing how many tags, triggers, and variables will be added, modified, or deleted. You can also click the link to View Detailed Changes to see which tags, triggers, and variables are being added, modified, or deleted.
















-
To create a new configuration tag in GTM. Please look at the image below: -
-
To get the measurement id you need to go to your GA4 view. Go to the admin settings and then data streams. Click on the website url coloured in blue and a popup should open.
-
You will see the Measurement ID listed on the top right corner of this page.
-
Now for the final step import our Google Analytics 4 JSON file in your GTM to get all the configurations for GA4. Once done you will see data flowing into Google Analytics 4. Learn more about Google Analytics 4
function gaAddToCart() {
jQuery.cookie.json = true;
var productToBasket = jQuery.cookie("productToBasket");
var productlist = jQuery.cookie("productlist");
if (productToBasket != undefined) {
manipulationOfCart(productToBasket, 'add', productlist);
jQuery.removeCookie("productToBasket", {
path: '/',
domain: '.' + document.domain
});
}
}
- AJAX Remove from Basket
function gaRemoveFromCart() {
jQuery.cookie.json = true;
var productOutBasket = jQuery.cookie("productOutBasket");
if (productOutBasket != undefined) {
manipulationOfCart(productOutBasket, 'remove', '');
jQuery.removeCookie("productOutBasket", {
path: '/',
domain: '.' + document.domain
});
}
}
- Set Primary Categories

scommerce:seo-base:set-primary-category
- N.B - If you are using older version then run the script provided in the extension folder at the path Data/SetPrimaryCategoryM2.php from ssh
- Upgrading the Module From 0.0.35 and Below
- If you are using an older version of the extension(0.0.35 and below) where a common data layer is used to populate data to both UA and GA4 then upon updating to the latest version you need to make the following changes in GTM.
- Remove these Tags, Triggers and Variables from GTM container
- TAGS
-
Google Analytics 4
-
GA4 Views/impressions of product/item details
-
GA4 View Item List Scroll
-
GA4 View Item List
-
GA4 Shipping info
-
GA4 Remove a product from a shopping cart
-
GA4 Refunds
-
GA4 Purchases
-
GA4 Promotion views/impressions
-
GA4 Promotion clicks
-
GA4 Product/Item List Clicks
-
GA4 Payment info
-
GA4 Begin Checkout
-
GA4 Add a product to a shopping cart
- Variables
- Ecommerce-detail-products
- Ecommerce-product-detail-value
- Ecommerce-checkout-products
- Ecommerce-checkout-option
- Ecommerce-remove-products
- Ecommerce-refund-products
- Purchase-affiliation
- Purchase-tax
- Purchase-shipping
- ecommerce-promoView-promotions
- ecommerce-promoClick-promotions
- Ecommerce-click-products
- ecommerce-product-click-list-name





