If your website loads Google Analytics 4 (GA4) via Google Tag Manager (GTM) instead of directly via gtag.js, additional configuration is required for ecommerce events to work correctly.
This guide explains:
If UniPixel loads gtag.js directly on your site:
Everything is handled automatically.
If your site loads GA4 through Google Tag Manager:
In this setup:
UniPixel sends the event
GTM forwards it to GA4
If GTM is not configured, events will not reach Google Analytics even though UniPixel is working correctly. This is how GTM is designed to operate.
When using UniPixel with GTM:
UniPixel already handles page_view tracking including consent logic and logging. Leaving automatic page view enabled inside GTM can cause duplicate page views.
For clarity and maintainability, use this naming format inside GTM:
This keeps ecommerce tracking organized and easy to manage.
Before creating any ecommerce tags, you must create the required Data Layer Variables. Without these variables, GTM cannot pass ecommerce parameters to GA4.
Go to Variables → New → Data Layer Variable and create the following:
| Variable Name | Data Layer Variable Name |
|---|---|
| DL – currency | currency |
| DL – value | value |
| DL – items | items |
| DL – transaction_id | transaction_id |
| DL – tax | tax |
| DL – shipping | shipping |
| DL – event_id | event_id |
Each variable must match the Data Layer key exactly.
Save.
Add Event Parameters:
| Parameter | Value |
|---|---|
| currency | {{DL – currency}} |
| value | {{DL – value}} |
| items | {{DL – items}} |
Attach Trigger: eCommerce – view_item
Save.
Parameters:
| Parameter | Value |
|---|---|
| currency | {{DL – currency}} |
| value | {{DL – value}} |
| items | {{DL – items}} |
Attach Trigger: eCommerce – add_to_cart
Parameters:
| Parameter | Value |
|---|---|
| currency | {{DL – currency}} |
| value | {{DL – value}} |
| items | {{DL – items}} |
Attach Trigger: eCommerce – begin_checkout
The purchase event is critical and must include transaction details.
Parameters:
| Parameter | Value |
|---|---|
| transaction_id | {{DL – transaction_id}} |
| currency | {{DL – currency}} |
| value | {{DL – value}} |
| tax | {{DL – tax}} |
| shipping | {{DL – shipping}} |
| items | {{DL – items}} |
| event_id (optional) | {{DL – event_id}} |
Attach Trigger: eCommerce – purchase
Platforms like Shopify follow the same pattern:
This is not a limitation of UniPixel. It is standard GTM architecture.
If GA4 is loaded via GTM:
Once configured correctly, WooCommerce ecommerce tracking works cleanly and reliably with GTM.