Overview
X-Cart supports Google Analytics 4 (GA4) and Google Tag Manager (GTM) integrations via dedicated add-ons:
Google Analytics add-on (GA4)
Google Tag Manager add-on (GTM)
When the Send events via GTM option is enabled in the Google Analytics add-on, all ecommerce events (such as purchase, add_to_cart, etc.) are routed through GTM instead of being sent directly to GA4.
This approach:
Prevents double-counting of events
Ensures proper ecommerce parameter handling
Centralizes tracking logic inside GTM
However, when this option is enabled, you must configure corresponding GA4 event tags inside GTM. Otherwise, ecommerce events will not appear in GA4.
Step 1: Configure Google Tag Manager in X-Cart
Go to GTM Settings in your X-Cart Admin area.
Enter your GTM Container ID.
Save changes.
If GTM is not configured, the Send events via GTM toggle will be visible but disabled.
Tooltip message:
To enable this option, please provide a Container ID in the GTM Settings page first.
Step 2: Enable “Send events via GTM”
Open the Google Analytics add-on settings.
Enable the Send events via GTM option.
Tooltip message:
Enable this to route all ecommerce data (purchases, add to cart, etc.) through GTM instead of sending it directly to GA4. This prevents double-counting and ensures correct data flow.
Why Ecommerce events may not appear in GA4
After enabling Send events via GTM, some merchants notice that:
Standard events like
page_vieware trackedEcommerce events like
purchaseoradd_to_cartare missing
This happens because:
X-Cart pushes ecommerce data into the dataLayer
GTM must be configured to listen for those events
Corresponding GA4 Event Tags and Triggers must exist in GTM
Without proper GTM configuration, ecommerce events will not be sent to GA4.
Step 3: Create the base Google Tag
Before creating GA4 event tags, make sure that your GTM container includes the base Google Tag. This tag initializes GA4 on your website and allows all subsequent event tags to send data to Google Analytics.
If your container already has a Google Tag configured, you can reuse it and skip this step.
To create the base Google Tag:
Open Google Tag Manager.
Go to Tags → New.
Click Tag Configuration.
Select Google Tag.
In the Tag ID field, enter your GA4 Measurement ID
(for example:G-XXXXXXXXXX).Under Triggering, select:
All Pages
Save the tag.
Step 4: Create a GA4 event tag in GTM
You must create a specific tag for each ecommerce action (purchase, add to cart, etc.). For the sake of example, we'll create a tag for purchase.
A. Create a new tag
Open Google Tag Manager.
Go to Tags → New.
Click Tag Configuration.
Select:
Google Analytics → Google Analytics: GA4 Event
In the Measurement ID field, enter your GA4 ID (starts with
G-).In the Event Name field, enter:
purchase
Event names must match GA4 recommended event names:
https://support.google.com/analytics/answer/9267735
B. Enable Ecommerce data
Inside the same Tag configuration:
Scroll to More Settings.
Open Ecommerce.
Check the box Send Ecommerce data.
Set Data Source to:
Data Layer
This ensures that all ecommerce parameters (items, value, currency, etc.) are correctly sent to GA4.
Step 5: Create a trigger
Now configure when the tag should fire.
Click the Triggering box at the bottom.
Click the + icon to create a new trigger.
Select Trigger Configuration → Custom Event.
In the Event name field, type the name of the event; in our case:
purchase
Save the trigger.
Save the tag.
Publish your GTM container.
Step 6: Repeat for other Ecommerce events
You must repeat this process for each ecommerce event you want to track, including:
add_to_cartremove_from_cartview_itemview_cartbegin_checkoutand any other ecommerce steps
Each event requires:
A GA4 Event Tag
A Custom Event Trigger
Ecommerce enabled
Exact event name match
Check the Tags and Triggers tabs to ensure you have everything in place:
Required events mapping
X-Cart Action | GTM Event Name | Description |
Item View |
| Product page visit |
Add to Cart |
| Clicking the buy button +1 |
Remove from Cart |
| Removing an item from the shopping cart +1 |
View Cart |
| Visiting the cart page |
Purchase |
| Successful order completion |
Step 7: Test and verify your tracking
Before going live, verify that your GTM and GA4 setup works correctly.
A. Validate in GTM Preview Mode
In Google Tag Manager, click Preview.
Enter your storefront URL to open the GTM Debugger.
Place a test order.
In the Debug panel:
Confirm that the
purchaseevent appears.Ensure the GA4 Event Tag status is Succeeded.
Verify that ecommerce parameters are present.
This confirms that GTM is correctly receiving and processing the event.
B. Confirm in GA4
Open Google Analytics 4
Go to:
Home → Reports → Realtime overview
Verify that:
The
purchaseevent appears.Transaction value is displayed.
Product items are included.
This confirms that GA4 receives complete ecommerce data.
We recommend verifying all your ecommerce events, not only purchase.
This ensures that the entire ecommerce tracking flow is configured correctly
Can't find answers you're looking for?
Email us at support@x-cart.com. We will be happy to help!
Related articles





