Google Analytics 4 module allows you to assign Google Analytics Measurement Id and Google Tag Manager Container Id for a Store and measure traffic, ecommerce events to collect information about the shopping behaviour of your users.
The module supports both direct GA4 integration and advanced Google Tag Manager integration for centralized tag management.
- Store Configuration.
- Measure ecommerce with Vue B2B Theme and Virto Storefront.
- Google Tag Manager integration for advanced tracking and tag management.
- Ready for integration with other sales channels.
- Application menu.
-
Save your Measurement Id (format:
G-XXXXXXXXXX) -
Go to Store Settings in Virto Commerce Back Office
-
Find the Google Analytics 4 section
-
Enable GoogleAnalytics4.EnableTracking
-
Enter your Measurement Id in GoogleAnalytics4.MeasurementId
-
Click Save
Google Tag Manager provides a centralized way to manage all your tracking tags without code changes. Use this option if you need:
- Multiple tracking tools (GA4, Facebook Pixel, LinkedIn Insight, etc.)
- Custom event tracking and triggers
- A/B testing tools
- Enhanced flexibility for marketing teams
- Create a Google Tag Manager account and container
- Save your Container ID (format:
GTM-XXXXXXX)
- In Google Tag Manager, create a new Google Analytics: GA4 Configuration tag
- Enter your GA4 Measurement ID
- Set the trigger to All Pages or Initialization - All Pages
- Configure any additional parameters (user properties, custom dimensions, etc.)
- Save and publish your container
- Go to Store Settings in Virto Commerce Back Office
- Find the Google Analytics 4 section
- Enable GoogleAnalytics4.EnableTracking
- Enter your GTM Container Id in GoogleAnalytics4.GtmContainerId (e.g.,
GTM-XXXXXXX) - (Optional) Enter your Measurement Id in GoogleAnalytics4.MeasurementId if you want both GTM and direct GA4 tracking
- Click Save
- Centralized Management: Update tracking configurations without code deployments
- Enhanced Events: Leverage
dataLayerfor rich ecommerce events - Multiple Tags: Add other marketing and analytics tools easily
- Testing: Preview and debug tags before publishing
- Load Order: GTM loads first, ensuring proper event sequencing for all tags
- If both GtmContainerId and MeasurementId are provided, GTM will load first, followed by direct GA4
- The module automatically pushes ecommerce events to
dataLayerwhich GTM can capture - All standard ecommerce events (add_to_cart, purchase, etc.) are available in
dataLayer
Virto Storefront and Vue B2B Theme has native integration with Google Analytics 4 module. Once you click Save for Store Settings, the Google Analytics tracking will be activated.
The module automatically tracks the following ecommerce actions and pushes them to dataLayer:
- view_item - View product details
- select_item - Select an item from a category
- add_to_cart - Add a product to shopping cart
- remove_from_cart - Remove a product from shopping cart
- view_cart - View shopping cart
- begin_checkout - Initiate the checkout process
- add_shipping_info - Add shipping information
- add_payment_info - Add payment information
- purchase - Complete purchases
- refund - Process refunds
- view_promotion - View promotions
- select_promotion - Apply promotions
If you're using GTM, you can capture these events by creating GA4 Event tags in GTM:
- In GTM, create a new Google Analytics: GA4 Event tag
- Set Configuration Tag to your GA4 Configuration tag
- Set Event Name to a custom variable that reads from
dataLayer(e.g.,{{Event}}) - Set the trigger to Custom Event matching the ecommerce events listed above
- Optionally, pass additional parameters using variables from
dataLayer - Save and publish your container
This allows you to:
- Customize event names before sending to GA4
- Add conditional logic to events
- Send events to multiple analytics platforms
- Debug events in GTM Preview mode
The module adds Google Analytics link into Application menu. It redirects to Google Analytics Dashboard. You could customize Google Analytics Dashboard Url in Platform Settings.
- Google Analytics 4
- Google Tag Manager
- GTM with GA4 Setup Guide
- GA4 Ecommerce Events
- Module Documentation
- View on GitHub
- Deployment: https://docs.virtocommerce.org/docs/latest/developer-guide/deploy-module-from-source-code/
- Installation: https://docs.virtocommerce.org/docs/latest/user-guide/modules/
- Home: https://virtocommerce.com
- Community: https://www.virtocommerce.org
- Download Latest Release
Copyright (c) Virto Solutions LTD. All rights reserved.
This software is licensed under the Virto Commerce Open Software License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://virtocommerce.com/opensourcelicense.
Unless required by the applicable law or agreed to in written form, the software distributed under the License is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.