GTM variable template that automatically extracts and transforms ecommerce data from the dataLayer into GA4-compatible format. Zero configuration needed.
- In Google Tag Manager, go to Templates > Search Gallery
- Search for dataLayer Picker | Up Blue
- Click Add to workspace
- Create a new variable using this template
The template reads the ecommerce object from the dataLayer and returns a clean, GA4-compatible object with all relevant ecommerce parameters.
- Reads the
ecommerceobject from the dataLayer - Falls back to
eventModelifecommerceis unavailable - Returns
undefinedif no ecommerce data exists
Always extracted (when present):
| Field | Description |
|---|---|
items |
Array of product objects |
value |
Transaction value |
currency |
Currency code |
coupon |
Discount/coupon code |
item_list_name |
Product list name |
item_list_id |
Product list ID |
Extracted for purchase/refund events:
| Field | Description |
|---|---|
transaction_id |
Order ID (also mapped from legacy id field) |
tax |
Tax amount |
shipping |
Shipping cost |
affiliation |
Store or affiliation |
Extracted for specific events:
| Field | Events |
|---|---|
payment_type |
add_payment_info, purchase |
shipping_tier |
add_shipping_info, purchase |
view_itemadd_to_cartadd_payment_infoadd_shipping_infopurchaserefund
This template requires no configuration — it works automatically out of the box.
Use this variable anywhere you need structured ecommerce data in GA4 format. Common use cases:
- Passing ecommerce data to tags that expect GA4-formatted objects
- Extracting transaction details for server-side tagging
- Normalizing legacy ecommerce dataLayer formats to GA4
Apache License 2.0 — see LICENSE for details.
Built and maintained by Up Blue.