Magento 2 Google Analytics 4 Enhanced Ecommerce Tracking

Extension for Magento by Anowave

  • In Stock
  • Price:
  • €169 90
  • SKU:
  • Premium product
  • Premium product

Google Analytics 4 for Magento 2 based on Google Tag Manager. Provides a full support for the Google Analytics 4 specification and allows for advanced Enhanced Ecommerce tracking for Magento 2 via the visionary GA4. The new Analytics adds AI-powered insights, tracks users across devices and provides more granular data controls.

lifetime updates180 days free support

GOOGLE Analytics 4 GOOGLE Tag Manager AdWords Dynamic Remarketing

Built for Magento 2

Magento 2 Google Analytics 4 Enhanced Ecommerce Tracking extension allows you to track all GA4 supported events using Google Tag Manager. It tracks events such as page_view, view_item_list, view_item, select_item, add_to_cart, remove_from_cart, purchase, begin_checkout, add_payment_info, add_shipping_info and much more.

It is the ALL-IN-ONE tool for Enhanced Ecommerce tracking.

Cover EVERY aspect of Google Analytics

It can be used to not only install Google Tag Manager in your Magento 2 store but also enable the awesome world of Enhanced Ecommerce by Google, AdWords Dynamic Remarketing and AdWords Conversion, Meta Conversion API etc.

In-Depth Analytics

You can receive in-depth data about your customers, their shopping behavior, your product performance, AdWords performance and more. Data collected includes information about product views, product clicks, cart additions, checkout behaviour progress, transactions and more.

Ton of BUILT-IN options

We have built this extension to be robust and comprehensive. It comes with built-in GDRP cookie consent feature, Google Tag Manager API support which automates the creation of tags, triggers and variables required for tracking, Facebook Pixel including Facebook Conversion API support,Google Optimize, Google Customer Reviews, full support for AdWords Conversion tracking and AdWords Dynamic Remarketing, backend order tracking, built-in self-assessment features and more...

What's included?

Extension files in ZIP format

6 months (180 days) of free support

Lifetime free updates





Magento 2 Google Analytics 4 is an extension for Magento 2 that delivers full support for Google Analytics 4 and covers EVERY aspect of the Enhanced Ecommerce tracking. It creates the dataLayer[] object so it can meet the new Google Analytics 4 specifications. The module implements all Google Analytics 4 (GA4) ecommerce features using Google Tag Manager. Being based on our GTM module, it provides a full range of additional features such as AdWords Dynamic Remarketing, AdWords Conversion Tracking, Social Network interaction tracking, Facebook Custom Audiences Pixel, Custom Dimensions, Google Customer Reviews, User ID data acquisition and User Timings Tracking.


Key features

  • A Magento 2 extension that HAS IT ALL
  • Enables Google Analytics 4 (GA4) through Google Tag Manager
  • Supports all essential events for proper Enhanced Ecommerce Tracking via Google Analytics 4 for Magento 2
  • Comes with a built-in API implementation which creates all GA4 tags, triggers and variables in any GTM container automatically
  • Can be turned on or off on demand
  • Hyvä Theme compatible (via additional compatibility module)
  • Comes with Measurement Protocol (Google Analytics 4) support. Built-in admin transaction tracking and refund tracking
  • All features from our GTM module are available (see below)
  • Compatible with custom Magento 2 themes
  • Compatible with Hyvä theme BRAND NEW
  • Track select_item event
  • Track augmented product clicks
  • Track view_item_list event in categories
  • Track an exteded set of view_item_list parameters e.g. category list/grid mode, current sort etc.
  • Track an extended set of custom events
  • Track view_item event
  • Track view_item event + view_item_list event for Related/Cross-sells and Up-Sells
  • Track configurable product view_item_event
  • Track pre-selected configurable attributes/swatches view (via URL query parameters)
  • Track add_to_cart event including quantities, product variants and options
  • Track cart quantity change/update
  • Track remove_from_cart event
  • Track begin_checkout, add_payment_info + add_shipping_info
  • Track checkout options such as shipping_tier, payment_method etc.
  • Track product add_to_compare event
  • Track product add_to_wishlist event
  • Track purchases (purchase event)
  • Track transactions made from Magento backend (admin orders)
  • Track refunds / built-in transaction reversal (for canceled orders)
  • Track refunds generated via REST API call
  • Track contact form submissions
  • Track newsletter submissions
  • Track clicks/cart additions from widgets (New products etc.)
  • Track search results
  • Track order coupon code
  • Track product-specific coupon code
  • Track apply coupon and cancel coupon events at checkout
  • Track brands
  • Track stock status
  • Track/correlate internal search with view_item_list and purchase events
  • Track direct add_to_cart event from categories
  • Track direct add_to_cart event for configurable swatch from categories
  • Track unsuccessful "Add to cart" of configurable product from categories / redirects to detail page
  • Google Tag Manager API Support with ability to create all tags, variables and triggers directly from Magento admin interface automatically * NEW
  • Google Analytics 4 Measurement Protocol Support to track offline orders, orders made from backend
  • Ability to send/track existing transactions (not recorded) to Google Analytics 4 manually (via mass actions)
  • Visitor data tracking including new_customer feature
  • AdWords Dynamic Remarketing support
  • AdWords Dynamic Remarketing support for Dynx_ (Other site) types
  • AdWords Conversion Tracking support (standard implementation)
  • AdWords Conversion Tracking support ( gtag.js implemenation)
  • Support for AdWords Enhanced Conversions
  • Ability to pick custom ecomm_prodid
  • Ability to initialise google_tag_params[] with pre-selected ecomm_prodid[] based on URL hash
  • Built-in affiliation tracking support based on GTM / cost per order (CPO) tracking. Product-scoped affiliate correlation.
  • Custom Definitions and Dimensions Support
  • Extended set of GTM variables allowing easy access to revenue, transaction id, visitor id etc. All suitable for implementing tags such as AWIN, TURN, Google Customer Reviews (former Trusted Stores) purely in Google Tag Manager
  • Extended Support for AMP (Accelerated Mobile Pages) GTM container types
  • Extended Support for Google Optimize (assisted and standalone implementation)
  • Built-in Cookie Law Consent Directive / Cookie Law friendly GTM implementation
  • Built-in Cookie Consent feature and Google Consent Mode
  • Extended GDPR (generic and segmented consent)
  • Facebook Upgraded Custom Audience Pixel Support for Magento
  • Meta Pixel Tag API Support
  • Meta Pixel Tracking / GDPR compatible
  • Meta Conversions API full support
  • Meta Conversion API/Pixel Event Deduplication
  • Track an extended set of Meta events (FB) such as CustomizeProduct
  • Presentation decoupling support
  • Private browsers fallback
  • Self-assessment support and correlation between placed orders and successfully tracked orders.
  • DIY (Do it yourself) user friendly JS API + Developer tools (custom events set to allow for adding your own parameters in JSON pushes)
  • Automatic 8KB payload limit mitigation
  • Capture Performance API data into User Timing reports
  • Persistent dataLayer[] data support
  • Adjustable tax settings
  • Supports Magento 2 default Full Page Cache
  • Supports Varnish cache
  • Supports Private data
  • Supports multi-store
  • Supports multi-currency
  • Supports transaction filter-out by payment method. Suitable for financial options
  • Support for PHP up to 8.2
  • Works fine with scripts moved to bottom of the page
  • Extended support for 3rd party onepage checkout solutions
  • Adjusted tracking for multi-category products / Advanced checkout/category correlation
  • No monthly fees


In-Depth Ecommerce Analytics

By enabling enhanced ecommerce you will be able to receive extended set of data with regards to your products, conversion, customers, promotions etc. You can see how your products and categories perform, how product position affects conversion rates and more.

What's included?

  1. Extension files in ZIP format
  2. 6 months (180 days) of free support
  3. Lifetime free updates

Enhanced Ecommerce tracking

Enhanced Ecommerce tracking is a combination between tracking product performance and customer actions. This extension handles enhanced ecommerce in it's entirety. It handles the following tracking automatically:

    Tracks product view_item, view_item_list including product positions and position performance, transactions, refunds, promotions impressions and detail views and more.
    Except for the enhanced ecommerce tracking, the extension also provides automatic tracking for User ID, AdWords Conversion Tracking, AdWords Dynamic Remarketing, Facebook Conversion Tracking and more.
    Tracks user actions such as "Add to cart", "Remove from cart", checkout steps including step options selected during checkout, user timings and more.

Google Tag Manager API

The module includes a built-in Google Tag Manager API implementation allowing for automatic GTM configuration with the click of a button. You can configure everything quickly and without any user errors. The API automatically creates all tags, triggers and variables in your Google Tag Manager account. Created tags get all required settings for Enhanced Ecommerce data. They are also automatically configured in terms of custom dimensions, special options etc. The API supports also the Google Analytics Settings common variables used for configuration grouping.


AdWords Conversion Tracking

Conversion tracking can help you see how effectively your ad clicks lead to valuable customer activity, such as website purchases, phone calls, app downloads, newsletter sign-ups and more.


AdWords Dynamic Remarketing

Remarketing allows you to show ads to people who have previously visited your website or used your mobile app. Dynamic remarketing takes this a step further, letting you show previous visitors ads that contain products and services they viewed on your site. With messages tailored to your audience, dynamic remarketing helps you build leads and sales by bringing previous visitors back to your site to complete what they started. The module will automatically initialize all required dataLayer[] variables for implementing proper AdWords Dynamic Remarketing. The API will also configure your GTM accont with regards to remarketing automatically.

Dynamic remarketing offers greater flexibility by providing more information and can use both static and dynamic ads - for example if you know the value of a visitor's abandoned basket you could decide to show a static ad only to visitors whose abandoned basket was over $50 in value and ignore those visitors where the value was less than $50. These rules can be configured within AdWords and are made possible by providing additional information in the google_tag_params.


Google Customer Reviews

The modules comes with a built-in Google Customer Reviews integration. Google Customer Reviews is a free service that allows online retailers to collect feedback from those who have made a purchase on their site. Essentially, it’s a way to earn Google product reviews. The built-in Google Customer Reviews integration will automatically add the suvery snippet and initialize dynamic values such as merchant_id, order_id, delivery_country and estimated_delivery_date automatically. It will also build the gtin products array based on purchased products. It provides an easy and intuitive configuration interface and does not require any development skills.


Facebook Pixel

The Facebook pixel is an analytics tool that allows you to measure the effectiveness of your advertising by understanding the actions people take on your website. You can use pixel data to:

a) Make sure your ads are being shown to the right people
b) Build advertising audiences
c) Unlock additional Facebook advertising tools

Setting up the Facebook pixel usually requires placing pixel code on the header of your website. This extension simplifies the process and allows you to insert the snippet in user-friendly input directly in your Magento admin panel. From then on snippet is placed automatically in the right place in your page. The module also handles Pixel events such as ViewContent, Search, AddToCart, AddToWishlist, InitiateCheckout, Purchase, CompleteRegistration etc.


EU Cookie Compliance

EUROPA websites must follow the Commission's guidelines on privacy and data protection and inform users that cookies are not being used to gather information unnecessarily.

The ePrivacy directive – more specifically Article 5(3) – requires prior informed consent for storage or for access to information stored on a user's terminal equipment. In other words, you must ask users if they agree to most cookies and similar technologies (e.g. web beacons, Flash cookies, etc.) before the site starts to use them.

For consent to be valid, it must be informed, specific, freely given and must constitute a real indication of the individual's wishes.

To operate properly Google Anlaytics stores cookies on client's browser and these cookies fall into EU cookie compliance directive. Google Analytics is covered by the requirements of the EU Cookie Law.  This means the website owners must seek consent for the use of GA. It's not only important to seek customer's consent but not store ANY cookies prior to obtaining it. Many such scripts just ask the customer but the cookie is already stored and although they do show the message, cookie directive law is in effect already broken. This module provides a mechanism for store owners to get customer's consent and do any tracking from then on. Once consent is granted, the module pushes an event in the dataLayer[] which can then be used as trigger for other consent dependent tags. This allows for flexible control on what tags fire and where. Cookie Compliance is optional and can be turned on/off on demand from Magento backend. This allows non-EU store owners to disable it.


User Timing Tracking

User Timings allows you to measure periods of time taken for the customer to do particular action. We have implemented this powerful feature of Google Analytics to work in favour of Enhanced Ecommerce Tracking. The extension will allow you to measure time taken for clicking a product, time taken for adding product to cart, time taken for completing a checkout step and more. Time reports include product name (where applicable), time taken in terms of milliseconds, product category (where applicable), checkout step name (where applicable).


Presentation decoupling

The module has built-in "presentation decoupling" support. This allows multi-language environments to be tracked using single UA-ID property. Instead of sending the current variant values, the extension will pick admin labels and push them in dataLayer[] object. This prevents data discrepancies within reports. To allow for data separation, the extension will push the current store name in dataLayer[] allowing for using custom dimension with each request. While in Europe different language means different country, in countries such as Canada for example, where people speak different languages withing the same country, presentation decoupling is very useful. It allows you to track the total sales and performance of your store and particular product(s).

Like any other feature of the module, presentation decoupling can be turned on and off on demand from the backend panel should you not need it.


Extended set of custom events

Apart from all Enhanced Ecommerce events, the module tracks an extended set of custom events e.g. changeProductImage, checkEmailAvailability, backToShippingMethod, cancelCouponCode, applyCouponCode. These help marketeers better understand customer actions and visit experience



Let's be honest, words mean nothing, but figures do. Find below a snapshot from the performance tests that we run with every extension that we offer in our store. Enhanced Ecommerce is no exception. We've measured page load time (in seconds) in Magento with this extension turned on/off completely. Below is the resulting comparison chart. The total impact on page load time is 183 milliseconds. Now you know.


Technical parameters used in the test: Apache on Windows 10 Pro 64 bit, 16GB RAM,  Intel Core I7 4600 U 2.7 GHz, SSD. Test conditions: All Magento cache turned OFF. Magento 2 mode: developer


8KB Payload mitigation

The analytics.js library refuses to send a hit if the full payload size is larger than 8192 bytes. This does require quite a lot of data to be stuffed within, but it only takes some dozens of product impressions to clog up the channel. For sites listing multiple products in categories e.g. not using pagination at all and/or listing all products at once, sending a standard impression tracking will not work. Even worse, store owner wouldn't even know about this and will certainly end up with inaccruate reports. We have implemented a feature to mitigate this problem. The module will track payloads in excess of 8KB and keep reports consistent and accurate.


Persistent dataLayer[] data support

Persistent dataLayer[] support is a brand new feature aiming to provide a cross-reference between transactions and specific customer actions. It allows for linking transactions with previously clicked promotions to actually show how a promotion performs with regards to conversions. You can not only see how many times a promotion has been clicked/viewed but also did it lead to transaction and generate a report on how your promotions perform and convert into real results. A persistent data is available in dataLayer[] object ALWAYS and can be used as cross-reference for other events as well.



0: Object 1: Object 2: Object persist: Object persist_promotion: Object promotion: Object creative: "Anowave" id: "banner" position: 1 __proto__ Object 0: Object 1: Object 2: Object ecommerce: Object items: Array [ {...} ] event: "add_to_cart"


The module comes with a built-in self-assessment feature. It allows for mapping placed orders with orders that were actually sent to Google Analaytics. From then on it gives the ability to check which placed orders were tracked in GA and which weren't (due to mutliple reasons e.g. hosted gateways, active ad-blockers etc.).


Developer friendly

Last but not least, the module is designed and developed in a developer friendly manner. It favours plugins, uses minimum set of rewrites (preferences), it also dispatches multiple custom events (see User guide below) that developers can hook to from their own modules. This keeps the module updateable and still very robust.


Premium support

The module comes with a premium support, you will get access to our helpdesk where support engineers are available to assist in every possible aspect of installation, configuration, usage and more. Updates are lifetime, free support is 180 days (full 6 months) and this can be later extended as well.

Magento platform version
2.* EE,2.3.*,2.4.*
Conversion rate,Mobile,Reporting
Latest version
## [100.4.4]

All our products come with a 6 full months (180 days) of premium support. To report a bug, use our Premium Help Desk available in your account at Anowave.

Customer review(s)

Purchased Magento 2 Google Analytics 4 Enhanced Ecommerce Tracking

We had a few issues with the API configuration mainly due to some wierd quota limitation by Google themselves but other than that with this extension we were able to switch to GA4 with ease. I'd like to thank the support team for all they did for us and helping us with the configuration. Spot on!

Yes, I recommend this product

Purchased Magento 2 Google Analytics 4 Enhanced Ecommerce Tracking

Works as described. It kept all the settings we had previously configured in the UA module which is awesome. Had to update the main module to latest version but that's understandable. Good work!

Yes, I recommend this product

Purchased Magento 2 Google Analytics 4 Enhanced Ecommerce Tracking

We have used Anowave's GTM solution for years and this was a natural choice. It's well designed, well maintained and the support is perfect. The GA4 module blends with the GTM one almost unnoticeably, we manage our stuff from where we used to. There were a few issues but they were mainly configuration oriented and the team helped quickly. Strongly recommend Anowave.

Yes, I recommend this product

Purchased Magento 2 Google Analytics 4 Enhanced Ecommerce Tracking

This is the only solution that worked for us with this crazy new GA4. The only disappointing bit was that we had to purchase their GTM module as well in order to run GA4 but the price tag was still fine for what we got.

What I like most is that dataLayer[] object is initialized for both GTM UA and GTM GA4 which is what we were looking for.

Support is premium, very polite and responsive. Keep up the good work!

Yes, I recommend this product

Purchased Magento 2 Google Analytics 4 Enhanced Ecommerce Tracking

This extension just works! It took a few minutes to setup including installation and container configuration which is really impressive! Support is outstanding as well. Thank you guys and thank you Angel for the brilliant attitude.

Yes, I recommend this product

Purchased Magento 2 Google Analytics 4 Enhanced Ecommerce Tracking

Although we had to install 2 separate modules to get GA4 running, it worked out of the box. No conflicts with anything on our site, tracking is comprehensive and when they say they had it all, they really meant it. We are discovering new features of this extension every day. Value for money 100%!

Yes, I recommend this product

Purchased Magento 2 Google Analytics 4 Enhanced Ecommerce Tracking

Fair priced module, helpdesk is responsive and very polite. They helped us with ton of adjustments way beyond the default features included. Thank you team Anowave!

Yes, I recommend this product

Note: By submitting a review you agree to our Terms and Conditions.

User Guide & Documentation

Installation from Command Line (Recommended)

This extension can be installed in a few minutes, by going through the following steps:

  • Download/purchase the extension
  • Unzip the file in a temporary directory
  • Copy directory contents and paste it in your Magento installation root directory. This extension will not replace existing code or file structure
  • Enter the following at the command line:

    php bin/magento setup:upgrade
    php bin/magento setup:static-content:deploy (only if site is in production mode)


Google Analytics 4 EVENTS / Google Analytics 4 Event tag

Enhanced Ecommerce tracking is done by sending enhanced measurement events via the so called Google Analytics 4 Event tag. We have outlined some of the essential events supported by the module which are sufficient for proper Enhanced Ecommerce tracking.

Measures promotion view

Measures click on a promotion

Measures product/item list views/impressions

Measures product click (from categories)

Measures product detail views

Measures click on "Add to Cart" button

Measures click on "Add to Wishlist" button

Measures click on "Remove from cart" button

Measures cart view

Measures checkout start

Measures selected shipping method

Measures selected payment method

Measures transactions on success page

Measures refunds


dataLayer[] Preview

This extension cannot be evaluated online, but we have prepared a preview of the dataLayer[] object throughout an ecommerce site.



Google Analytics 4 Configuration tag

The Google Analytics: GA4 Configuration tag initializes Google Analytics for your Google Analytics 4 property on a particular page. It handles behavior such as setting of Google Analytics cookies, sending automatic and enhanced measurement events, and declaration of common settings. In effect this is the tag that does 90% of the work and installs Google Analytics 4 on the site.

The built-in API will create this tag for you automatically



Google Analytics 4 (Installation/Configuration)

Watch a quick video on YouTube -

Anowave_Ec4 module works on top of our Anowave_Ec module, it's designed to modify the dataLayer[] object as per GA4 specification (

When installed:

1. A new field called Measurement ID appears in Google Tag Manager API configiration section. This is obtained from Google Analytics 4 and it's in the following format: G-XXXXXXXXXX

2. A 3 new checkboxes appear that allow you to:

a) Create GA4 variables
b) Create GA4 triggers
c) Create GA4 tags (creates also the Google Analytics 4 configuration tag)

3. Google Analytics 4 Configuration tag

The Google Analytics: GA4 Configuration tag initializes Google Analytics for your Google Analytics 4 property on a particular page. It handles behavior such as setting of Google Analytics cookies, sending automatic and enhanced measurement events, and declaration of common settings. This is in effect what tracks Pageviews and installs Google Anlaytics 4 on your site

4. dataLayer[] modifications

dataLayer[] object gets modified as per GA4 specification (

5. To our understanding, it's better to create a new empty container and use the API to configure it for GA4 by clicking only the GA4 checkboxes from our API, this will create the GA4 variables,triggers and tags including the Google Analytics 4 Configuration tag. Having the container inflated with the old tags is not a mistake but they won't fire or if some of them fires it could duplicate and/or corrupt data.

6. There are certain limitations of GA4 (due to being in beta mode probably) to be aware of:

a) Checkout can no longer be tracked in terms of checkout steps. There are a few events dispatched:


b) Product list attribution no longer works, it's simply not available yet in GA4
c) There are no more product-scoped dimensions.


Configuration steps

Configuration is really simple but it will require some pre-config steps. In order to track stuff properly, you have to have a GTM container configured with the required tags/triggers and variables. You can do this configuration really easy using the built-in API. It requires no technical expertise whatsoever.

We have outlines a few configuration steps below required for module to work properly:


1. Install the module

2. Enter a license key in Stores -> Configuration -> Anowave Extensions -> Google Tag Manager GA4 and set Enable to "Yes"

3. Go to Stores -> Configuration -> Anowave Extensions -> Google Tag Manager and expand the Google Tag Manager API section

4. Enter your Account ID and click Sign in

5. Once singed in, pick the Container ID which you want to configure. It is recommended to configure an empty/new container to avoid messing with UA tags

6. Enter your Measurement ID

7. Click ONLY GA4 related checkboxes e.g. Create variables (GA4)/Create triggers (GA4)/Create tags (GA4). Make sure not to click the first 3 checkboxes because they will create also standard UA tags in your container

8. Click "Save config" (note that saving could take a while so be patient)


AdWords Conversion Tracking and AdWords Dynamic Remarketing

To configure AdWords, check the steps/guide outlined below.

General Setup

1. AdWords Conversion Tracking

In our extension configuration screen go to AdWords Conversion Tracking tab and insert your conversion id and conversion label (obtained from AdWords). The word "purchase" is default and should be replaced with your own label. Once these are inserted, flush cache and conversion tracking should work out of the box. You don't need to define anything in terms of GTM tag/configuration. AdWords Conversion Tracking is built-in in our module for customer ease.

2. AdWords Dynamic Remarketing

If you used our API to create all triggers, then you should have a tag called EE AdWords Dynamic Remarketing and 2 variables in GTM -> Variables e.g. "ee conversion id" and "ee conversion label"

a) Go to GTM -> Variables and edit "ee conversion id" variable. Insert your conversion id (obtained from AdWords)
b) Go to GTM -> Variables and edit "ee conversion label" variable. Insert your conversion label (obtained from AdWords)

c) Publish new container version

This will activate AdWords Dynamic Remarketing.


Our latest versions support Enhanced Conversions Enhanced conversions is a feature that can improve the accuracy of your conversion measurement. It supplements your existing conversion tags by sending hashed first-party conversion data from your website to Google in a privacy-safe way.

Before you begin, watch a short video on YOUTUBE -

Enhanced Conversion tracking is supported in multiple ways via our module.

gtag.js based

1) If you switch to gtag.js based conversion tracking (selected from Implementation dropdown in config screen), Enhanced Conversion tracking will be enabled by default

To switch to gtag.js based conversion tracking:

a) Go to Stores -> Configuration -> Anowave Extensions -> Google Tag Manager -> Beta panel and set Beta to Yes
b) Go to Stores -> Configuration -> Anowave Extensions -> Google Tag Manager -> AdWords and set "Implementation" to "Using gtag.js"
c) Insert your gtag.js global site tag snippet. If you are to enable Enhanced Conversions you also MUST modify the gtag snippet to include the following configuration:

gtag('config', 'AW-xxx',
    'allow_enhanced_conversions': true

d) Insert "Send to" parameter (it is available in your account at AdWords -> Tools & Settings -> Conversions -> (Select conversion) -> Tag Setup -> Install the tag yourself -> Event snippet

Custom implementation

2) If you'd like to do your own implementation, our module defines a global JS variable - enhanced_conversion_data

The global JS variable enhanced_conversion_data is a JSON object with the following properties.

AdWords End Configuration


Enabling Enhanced Conversions for Conversion Actions

1. Go to Goals -> Conversions -> Settings
2. Expand Enhanced Conversions
3. Click Turn On Enhanced Conversions
4. Under 'Choose a method for setting up and managing user-provided data' select 'Google Tag'
5. Click Tag details
6. Check Specify CSS selectors or JavaScript variables
7. Activate each selector, next to each selector select 'Global Javascript variable', then insert (example is for email)

Other values may include:

8. Once all fields are filled, click Save.

Common Troubleshooting

1. Error type: Missing user data fields / Not enough matches for your conversion

Fix: Configure the conversion in AdWords to only use the email and the phone fields, and not the address. Region field could be null for UK purchases and the diagnostics would be flagging that the data being sent was incomplete.


Promotions & Promotion tracking

This module can track promotion views and promotion clicks. However, different customers use different promotions e.g. banners, sliders, static images etc. which makes it impossible to track them all. To solve this we have introduced a smart way to enable promotions in your site by doing a few code changes at HTML level. Althought this is DYI, it's very easy to achieve.

To make an object promotion simply add data-promotion="true" attribute. Then add the rest of the attributes from Enhanced Ecommerce specification related to promotions e.g.

  1. data-promotion-creative="squareBanner"
  2. data-promotion-name="Square Banner"
  3. data-promotion-position="1"
  4. data-promotion-id="SQUARE_BANNER"

Note: Values are fictional. Fill in your own values.

A typical HTML element would look like shown in the figure below.

data-promotion-* attributes can be applied to any element on the page.


Advanced Developer Configuration / Selectors

Parts of the tracking related to event tracking may involve adjusting a few configuration selectors. Under Advanced Developer Configuration we have exposed a few selectors which provide a flexible mechanism of detecting elements on your page and binding the corresponding tracking e.g. productClick, addTocart etc. These selectors are XPath selectors. XPath uses path expressions to select nodes or node-sets in an XML document. The node is selected by following a path or steps.

In effect these selectors describe the path to specific elements on your page and allow the module to hook to them dynamically. There are several important selectors.

1. Impression list selector - Used to detect a list of products in categories
2. Impression click selector - Used to detect a clickable element e.g. product title, image from categories
3. Add to cart selector from categories - Used to detect direct "Add to cart" button from categories

There are also other less important selectors with self-explanatory names.

One may find this part of the configuration a bit technical so if you're unsure how to configure or if these need to be adjusted at all, please contact our help desk. Support engineers will clarify on this.

For technical person, it should be relatively easy to adjust these as long as you're aware on the following.

a) "//" double slash means an absolute selector, if selector starts with double slash e.g. // it will be applied on the whole content, in some cases could be the whole page or the listings HTML

b) If a selector starts with element, it's then a relative selector and will be applied on the content matched from the previous/dependable selector. Impression click selector for example depends on impression list selector. The first one must be absolute selector while latter one should be relative.

A good example would be:

a) Presume category products are listed in ORDERED LIST e.g. OL/LI, OL has ID - products, in this case the Impression list selector becomes: //ol[contains(@class,"products")]/li which reads "pick ALL LI elements which are direct children of OL element with attribute ID equal to "products"

b) Presume that product link which we need to track productClick exists in OL/LI/DIV/A with class "product-image", the Impression click selector becomes: DIV/A[contains(@class,"product-image")] which reads "pick A element which is child of DIV element which is direct child of previously matched LI element


Cookie Consent / GDPR

The latest version of the extension comes with built-in Cookie Consent directive. This allows visitors to choose whether they allow site owner to collect and store cookies. A cookie is a small piece of data that a website asks your browser to store on your computer or mobile device. The cookie allows the website to "remember" your actions or preferences over time.

Most browsers support cookies, but users can set their browsers to decline them and can delete them whenever they like.


Cookie Consent Configuration

To enable this feature go to Stores -> Configuration - Anowave Extensions -> Google Tag Manager -> Cookie Consent Directive and set "Enable Cookie Consent" to "Yes". Configure other settings as per your requirments.

Enabling Cookie Consent however isn't sufficient because some of your tag may still fire. In most cases, the Universal Analytics tag that fires on all pages will still fire. To prevent this, you need to change the tag trigger from All pages to custom event e.g. cookieConsentGranted. This event will be fired once visitor accepts cookie usage and on every page from then on.

Important: If cookie consent is disabled the Universal Analytics tag trigger should be reverted back to "All pages", otherwise it won't fire thus losing essential tracking data such as page views, transactions etc.


Developer reference

Find below a list of the custom events dispatched by our module. These can be used to interact with the dataLayer[] object from your own modules and push/modify data covering your own requirements.


Allows 3rd party modules to modify widget click attributes e.g. data-attributes="{[]}"

Allows 3rd party modules to modify widget add to cart attributes e.g. data-attributes="{[]}"

Allows 3rd party modules to modify product click attributes e.g. data-attributes="{[]}"

Allows 3rd party modules to modify add to cart from categories attributes e.g. data-attributes="{[]}"

Allows 3rd party modules to modify category click attributes e.g. data-attributes="{[]}"

Allows 3rd party modules to modify remove click attributes e.g. data-attributes="{[]}"

Allows 3rd party modules to modify add to cart attributes e.g. data-attributes="{[]}"

Allows 3rd party modules to modify search list attributes e.g. data-attributes="{[]}"

Allows 3rd party modules to modify checkout step attributes e.g. data-attributes="{[]}"

Allows 3rd party modules to modify single item from impressions

Allows 3rd party modules to modify impressions array []

Allows 3rd party modules to modify detail attributes array []

Allows 3rd party modules to modify related attributes

Allows 3rd party modules to modify upsell attributes

Allows 3rd party modules to modify detail array []

Allows 3rd party modules to modify single transaction product []

Allows 3rd party modules to modify transaction products array

Allows 3rd party modules to modify purchase attributes

Allows 3rd party modules to modify search array attributes

Allows 3rd party modules to modify payload for measurement protocol

Allows 3rd party modules to modify the purchase push


Performance optimisation

The module is developed in a way that dataLayer[] object gets initialized prior to sending a Pageview. While this brings more natural way of sending data to Google Analytics, it may bring minor performance issues mainly due to the fact that GTM snippet is located in HEAD section and this is where Pageview is fired. To get the dataLayer[] object initialized correctly, the module does some data pre-fetching. Performance impact is minimal on all pages except for category pages where payload could be significant especially in categories with lots of products. To improve performance you can pick from 2 types of dataLayer[] initializations e.g. Before Pageview and After Pageview. The latter one improves performance drastically however it requires additional adjustments in GTM tags and triggers. By delivering those 2 selectable types of initializations the module allows you to pick between more natural dataLayer[] initialization and improved performance.

To set dataLayer[] initialization model go to Stores -> Configuration -> Anowave Extensions -> Google Tag Manager -> Enhanced Ecommerce Tracking Preferences -> Impression Payload Model. In there we have included a User Guide that explains this feature in detail and the changes you need to do depending on the chosen initialization model.

Another bottleneck could be deeply nested category hierarchy and also number of categories. On sites with 2000+ categories, performance could be improved by disabling a setting called Use category segments from our module. When disabled, the module will not send the category as slash separated string but only the very category that product exists.


Assessing installation

If installed properly, Google Tag Manager should contain (at minimum) the tags shown in the figure below.

Tags Name Type Firing triggers Last edited EE AdWords Dynamic Remarketing Google Analytics Remarketing Event Equals Dynamic Remarketing 6 min ago EE4 Add Payment Info Google Analytics: GA4 Event GA4 Event Equals Add Payment Info 1 month ago EE4 Add Shipping Info Google Analytics: GA4 Event GA4 Event Equals Add Shipping Info 2 min ago EE4 Add To Cart Google Analytics: GA4 Event GA4 Event Equals Add To Cart 2 min ago EE4 Add To Compare Google Analytics: GA4 Event GA4 Event Equals Add To Compare 2 min ago EE4 Add To Wishlist Google Analytics: GA4 Event GA4 Event Equals Add To Wishlist 2 min ago EE4 Begin Checkout Google Analytics: GA4 Event GA4 Event Equals Begin Checkout 2 min ago EE4 Purchase Google Analytics: GA4 Event GA4 Event Equals Purchase 2 min ago EE4 Refund Google Analytics: GA4 Event GA4 Event Equals Refund 2 min ago EE4 Remove From Cart Google Analytics: GA4 Event GA4 Event Equals Remove From Cart 2 min ago EE4 Select Item Google Analytics: GA4 Event GA4 Event Equals Select Item 2 min ago EE4 Select Promotion Google Analytics: GA4 Event GA4 Event Equals Select Promotion 2 min ago EE4 View Cart Google Analytics: GA4 Event GA4 Event Equals View Cart 2 min ago EE4 View Item Google Analytics: GA4 Event GA4 Event Equals View Item 2 min ago EE4 View Item List Google Analytics: GA4 Event GA4 Event Equals View Item List 2 min ago EE4 View Promotion Google Analytics: GA4 Event GA4 Event Equals View Promotion 2 min ago EE4 View Promotion Google Tag All pages 2 min ago


Testing & Debugging

Unlike Universal Analytics, testing Google Analytics 4 could be tricky and time consuming. We have prepared a few steps below to use as a guide on how to test and debug Google Analytics 4.

1. Prepare GTM for debugging

In order to start the debugging process you must prepare GTM for debugging. To do so, edit GA4 Configuration tag and under Fields to set add new Field with Field name: debug_mode and Value: true (as shown below)

<svg viewBox="0 0 750 200" preserveAspectRatio="xMidYMid meet" "="" xmlns="" xmlns:xlink=""> Configuration Settings Configuration parameter debug_mode Value true Add parameter

Once done, Publish new container version so changes could take effect.

2. Run GTM in Preview mode

To run GTM in Preview mode, go to GTM and click Preview. You will be requested to enter your domain and from then on GTM will open a new debug window.

Configuration Settings Configuration parameter debug_mode Value true Add parameter

3. Open Google Anlaytics 4 DebugView

Go to Google Analytics -> Confiure -> Debug view. This will open GA4's debug view screen where you can observe the events fired in real time. If everything is set correctly, you should see your browser in DEBUG DEVICE dropdown.

17:53:12 3s add_to_cart 17:46:12 7s user_engagement 17:42:12 7s select_item 17:35:36 7s view_item_list 17:30 am 2s page_view

If all 3 points above are done, you can now start testing. Browse the site as regular user, check what tags fire in GTM Preview console, check what events fire in DebugView in GA4. You can also place a test order and check if both EE4 Purchase tag is fired and the 'purchase' event is shown in DebugView.


Avoiding Google Analytics 4 Discrepancies

Google Analytics 4 despite being new stuff, proved to be hard to work with and has potentially steep learning curve. We're learning new stuff ourselves everyday so let's check the following stuff that could be causing incorrect reports. Function-wise our extension is designed and working as per Google's specifications displayed here -, dataLayer[] object is initialized with all the required parameters and the payload that is being pushed for every event meets the requirements. Still, there are few things that could be causing missing or invalid data in your GA4 property.


Google Analytics for has insane data latency, sometimes up to 48 hours or even more. If you've placed a test order today or yesterday, they might not appear yet in your reports.


From technical perspective, the following things should be checked and verified

2.1 Check what version you have of Anowave_Ec4 module (check app/code/Anowave/Ec4/ If lower than ## [100.4.3] - 17/05/2022, upgrade both Anowave_Ec and Anowave_Ec4 to latest versions.

2.2 Check if you have the following TAGS in your GTM container:

EE AdWords Dynamic Remarketing
EE4 Add Payment Info
EE4 Add Shipping Info     
EE4 Add To Cart     
EE4 Add To Compare
EE4 Add To Wishlist    
EE4 Begin Checkout    
EE4 Purchase    
EE4 Refund    
EE4 Remove From Cart    
EE4 Select Item    
EE4 Select Promotion    
EE4 View Cart    
EE4 View Item    
EE4 View Item List    
EE4 View Promotion    
GA4 Configuration

2.3 Edit EE4 Purchase tag and check if ALL of the following Event parameters are set.


Missing 'currency' parameter will cause revenue to show as $0.00 instead of the actual revenue.

2.4 DUPLICATE events/transactions

There are multiple reasons that could be causing this, I have described most common ones below.

I highly recommend this article -

It describes most of the potential reasons for duplicate stuff.


Confirming that GA4 is tracking data properly is usually done by a combination of running GTM in Preview mode and setting GA4 in DebugView

To use the DebugView report:

3.1 Enable debug mode

To enable debug mode, edit GA4 Configuration tag and under Fields to set, add new field with Field name set to "debug_mode" and Value set to "true". Once done, publish the container

3.2 Observe events as they are tracked

To check events run GTM in Preview mode and then go to your Google Analytics 4 Property -> Configure > DebugView

You should see all events here the moment they fire on your site, you can now place a test order and see if the 'purchase' event is fired and if it has all the parameters required for successful tracking.

Transactions are tracked by the EE4 Purchase tag. Make sure that this tag appears in the list of fired tags on your success page. This will ensure that transaction data is sent to Google Analytics 4 successfully


In addition to stuff described in pt. 3 (see above), as a developer you can use the browser console to check if transactions are tracked properly.

4.1 To test it in the browser, hit F12 to display Developer Tools (in Firefox or Chrome)
4.2 Select Network tab which displays all network requests and type a manual filter e.g. "collect?v=" to filter Google Analytics 4 requests only.
4.3 Place a test order and inspect the network requests. There should be at least one POST request with the following headers:


ep.debug_mode true
ep.transaction_id 000000060
epn.value 7220
epn.shipping 0 1200
ep.affiliation Default Store View


Now: Next:

If you like this product, share it with your friends

Extensions for Magento

Anowave is an extension developer for Magento 1.x and Magento 2.x platforms. We provide a wide range of premium extensions for our in-house and public clients. The extensions that we offer extend the capabilities of Magento and provide a bespoke functionality. They also fill some missing gaps in the functionality provided by the base platform and help customers in chosing Magento as prefered ecommerce platform.

The extensions that we offer are part of our full range Magento service which includes also a Premium Helpdesk where customers get to speak with actual software engineers and get their issues resolved without hussle. Premium labeled modules also include free installation, confiuration, testing etc.