### GTM Setup Overview for EEC DataLayer Builder Source: https://context7.com/matteo-zambon-gtm/eec-datalayer-builder-for-ga4/llms.txt This overview details the components required for the GTM setup, including custom variables, data layer variables, triggers, and GA4 event tags. It serves as a configuration guide for integrating the EEC DataLayer Builder for GA4. ```plaintext GTM Setup Overview ────────────────────────────────────────────────────────────────── VARIABLES (Custom Template — EEC DataLayer Builder for GA4) {{GA4 – Event Name}} Mode: Event Name (configure checkout steps) {{GA4 – Items}} Mode: Items (configure default currency if needed) DATA LAYER VARIABLES (for purchase parameters) {{dlv - transaction_id}} → ecommerce.purchase.actionField.id {{dlv - affiliation}} → ecommerce.purchase.actionField.affiliation {{dlv - value}} → ecommerce.purchase.actionField.revenue {{dlv - tax}} → ecommerce.purchase.actionField.tax {{dlv - shipping}} → ecommerce.purchase.actionField.shipping {{dlv - currency}} → ecommerce.currencyCode {{dlv - coupon}} → ecommerce.purchase.actionField.coupon TRIGGERS [GA – EEC Events] Custom Event (regex): gtm4wp.addProductToCartEEC|gtm4wp.checkoutStepEEC|gtm4wp.productClickEEC| gtm4wp.productImpressionEEC|gtm4wp.promoClickEEC|gtm4wp.promoImpressionEEC [GA – EEC Purchase] Custom Event: gtm4wp.orderCompletedEEC TAGS [GA4 – EEC] Type: GA4 Event Event Name: {{GA4 – Event Name}} Parameters: items → {{GA4 – Items}} Triggers: All Pages + GA – EEC Events [GA4 – EEC Purchase] Type: GA4 Event Event Name: purchase Parameters: items → {{GA4 – Items}} transaction_id → {{dlv - transaction_id}} affiliation → {{dlv - affiliation}} value → {{dlv - value}} tax → {{dlv - tax}} shipping → {{dlv - shipping}} currency → {{dlv - currency}} coupon → {{dlv - coupon}} Trigger: GA – EEC Purchase ────────────────────────────────────────────────────────────────── ``` -------------------------------- ### UA Checkout Step to GA4 Event Name Source: https://context7.com/matteo-zambon-gtm/eec-datalayer-builder-for-ga4/llms.txt This example demonstrates how the 'Event Name' mode maps a UA checkout step event to a specific GA4 checkout event. The mapping depends on the configured `add_shipping_info` step number. ```javascript // Example: checkout step push dataLayer.push({ event: 'gtm4wp.checkoutStepEEC', ecommerce: { checkout: { actionField: { step: 2 }, // step 2 → "add_shipping_info" (default config) products: [{ name: 'Running Shoes', id: 'SKU-001', price: '89.99', quantity: 1 }] } } }); ``` ```plaintext // GTM Variable "GA4 – Event Name" (Mode: Event Name, add_shipping_info step = 2) returns: // → "add_shipping_info" ``` -------------------------------- ### GA – EEC Events Trigger Configuration Source: https://github.com/matteo-zambon-gtm/eec-datalayer-builder-for-ga4/blob/main/README.md Set up the 'GA – EEC Events' trigger to capture all custom events related to Universal Analytics Enhanced Ecommerce. This example uses events from WooCommerce and the Duracell Tomi plugin. ```Google Tag Manager gtm4wp.addProductToCartEEC|gtm4wp.checkoutStepEEC|gtm4wp.productClickEEC|gtm4wp.productImpressionEEC|gtm4wp.promoClickEEC|gtm4wp.promoImpressionEEC ``` -------------------------------- ### Map UA Promotion Events to GA4 Source: https://context7.com/matteo-zambon-gtm/eec-datalayer-builder-for-ga4/llms.txt Promotion impression (promoView) and click (promoClick) UA events map to GA4's view_promotion and select_promotion. The 'GA4 – Items' variable in Items mode returns promotion objects with specific fields. ```javascript // Example dataLayer push — UA promo impression dataLayer.push({ event: 'gtm4wp.promoImpressionEEC', ecommerce: { promoView: { promotions: [ { id: 'PROMO_001', name: 'Summer Sale Banner', creative: 'banner_hero_v2', position: 'slot_1' } ] } } }); // GTM Variable "GA4 – Event Name" (Mode: Event Name) returns: // → "view_promotion" // GTM Variable "GA4 – Items" (Mode: Items) returns: // [ // { // promotion_id: 'PROMO_001', // promotion_name: 'Summer Sale Banner', // creative_name: 'banner_hero_v2', // creative_slot: 'slot_1' // } // ] ``` -------------------------------- ### Configure Checkout Step Mapping in GTM Source: https://context7.com/matteo-zambon-gtm/eec-datalayer-builder-for-ga4/llms.txt Checkout step mapping is configured in the GTM variable UI, assigning numeric UA checkout steps to GA4 checkout events. 'view_cart' is opt-in. Defaults are: begin_checkout = step 1, add_shipping_info = step 2, add_payment_info = step 3. ```javascript // Template parameter defaults (configured in GTM variable UI, not in code): // beginCheckoutStep = 1 → UA checkout step 1 maps to GA4 "begin_checkout" // addShippingInfoStep = 2 → UA checkout step 2 maps to GA4 "add_shipping_info" // addPaymentInfoStep = 3 → UA checkout step 3 maps to GA4 "add_payment_info" // tickViewCart = false (opt-in) // viewCartStep = '' → if enabled, e.g. set to 4 for UA checkout step 4 // Example: site uses steps 1–4, where step 4 is the payment screen dataLayer.push({ event: 'gtm4wp.checkoutStepEEC', ecommerce: { checkout: { actionField: { step: 4 }, products: [{ name: 'Running Shoes', id: 'SKU-001', price: '89.99', quantity: 1 }] } } }); // With addPaymentInfoStep configured to 4 in the GTM variable UI: // GTM Variable "GA4 – Event Name" returns → "add_payment_info" ``` -------------------------------- ### GA – EEC Purchase Trigger Configuration Source: https://github.com/matteo-zambon-gtm/eec-datalayer-builder-for-ga4/blob/main/README.md Configure the 'GA – EEC Purchase' trigger to specifically capture the custom event for the purchase action. ```Google Tag Manager gtm4wp.orderCompletedEEC ``` -------------------------------- ### GA4 - Items Configuration Source: https://github.com/matteo-zambon-gtm/eec-datalayer-builder-for-ga4/blob/main/README.md Configure the 'GA4 - Items' variable to process item data for GA4 ecommerce tracking. This variable should be set to 'Mode > Items'. ```Google Tag Manager Mode > Items ``` -------------------------------- ### GA4 - Event Name Configuration Source: https://github.com/matteo-zambon-gtm/eec-datalayer-builder-for-ga4/blob/main/README.md Configure the 'GA4 - Event Name' variable to map Universal Analytics checkout steps to GA4 event names. The default step values are provided. ```Google Tag Manager Mode > Event Name ``` -------------------------------- ### GA4 – EEC Tag Configuration Source: https://github.com/matteo-zambon-gtm/eec-datalayer-builder-for-ga4/blob/main/README.md Create a GA4 Event Tag for general EEC events. This tag utilizes the '{{GA4 – Event Name}}' and '{{GA – Items}}' variables and is triggered by 'All Pages' and the 'GA – EEC – Events' trigger. ```Google Tag Manager GA4 Event Tag ``` -------------------------------- ### Data Layer Variables for Purchase Source: https://github.com/matteo-zambon-gtm/eec-datalayer-builder-for-ga4/blob/main/README.md Create these 7 Data Layer variables to capture purchase-specific parameters that are outside the '__items__' array in the GA4 ecommerce object. These are necessary for accurate purchase event tracking. ```Google Tag Manager ecommerce.purchase.actionField.id ``` ```Google Tag Manager ecommerce.purchase.actionField.affiliation ``` ```Google Tag Manager ecommerce.purchase.actionField.revenue ``` ```Google Tag Manager ecommerce.purchase.actionField.tax ``` ```Google Tag Manager ecommerce.purchase.actionField.shipping ``` ```Google Tag Manager ecommerce.currency ``` ```Google Tag Manager ecommerce.purchase.actionField.coupon ``` -------------------------------- ### Configure Purchase Event DataLayer Variables Source: https://context7.com/matteo-zambon-gtm/eec-datalayer-builder-for-ga4/llms.txt For GA4 purchase events, transaction-level fields must be passed as top-level event parameters. These require specific Data Layer Variables in GTM to map UA EEC purchase actionField paths to GA4 parameters. The 'GA4 – Items' variable handles the items array. ```javascript // Example dataLayer push — UA purchase dataLayer.push({ event: 'gtm4wp.orderCompletedEEC', ecommerce: { currencyCode: 'USD', purchase: { actionField: { id: 'TXN-9981', affiliation: 'Online Store', revenue: '259.98', tax: '20.80', shipping: '5.99', coupon: 'SUMMER10' }, products: [ { name: 'Running Shoes', id: 'SKU-001', price: '129.99', quantity: 1 }, { name: 'Sports Socks', id: 'SKU-099', price: '9.99', quantity: 3 } ] } } }); // Required GTM Data Layer Variables (set these up manually in GTM): // {{dlv - transaction_id}} → ecommerce.purchase.actionField.id → "TXN-9981" // {{dlv - affiliation}} → ecommerce.purchase.actionField.affiliation → "Online Store" // {{dlv - value}} → ecommerce.purchase.actionField.revenue → "259.98" // {{dlv - tax}} → ecommerce.purchase.actionField.tax → "20.80" // {{dlv - shipping}} → ecommerce.purchase.actionField.shipping → "5.99" // {{dlv - currency}} → ecommerce.currencyCode → "USD" // {{dlv - coupon}} → ecommerce.purchase.actionField.coupon → "SUMMER10" // GTM Variable "GA4 – Items" (Mode: Items) for purchase returns: // [ // { item_name: 'Running Shoes', item_id: 'SKU-001', price: 129.99, quantity: 1, currency: 'USD' }, // { item_name: 'Sports Socks', item_id: 'SKU-099', price: 9.99, quantity: 3, currency: 'USD' } // ] ``` -------------------------------- ### UA Product Impression to GA4 Event Name Source: https://context7.com/matteo-zambon-gtm/eec-datalayer-builder-for-ga4/llms.txt When using the 'Event Name' mode, this snippet shows how a UA product impression event is mapped to the GA4 `view_item_list` event name. Ensure the GTM variable is configured to 'Event Name' mode. ```javascript dataLayer.push({ event: 'gtm4wp.productImpressionEEC', ecommerce: { currencyCode: 'USD', impressions: [ { name: 'Running Shoes', id: 'SKU-001', price: '89.99', brand: 'SpeedBrand', category: 'Footwear/Running', variant: 'Blue', list: 'Search Results', position: 1 } ] } }); ``` ```plaintext // GTM Variable "GA4 – Event Name" (Mode: Event Name) returns: // → "view_item_list" ``` -------------------------------- ### UA Add to Cart to GA4 Items Array Source: https://context7.com/matteo-zambon-gtm/eec-datalayer-builder-for-ga4/llms.txt When using the 'Items' mode, this snippet illustrates the transformation of a UA 'add to cart' event's product data into a GA4-compatible `items` array. Custom dimensions and metrics are preserved. ```javascript // Example dataLayer push — UA add to cart dataLayer.push({ event: 'gtm4wp.addProductToCartEEC', ecommerce: { currencyCode: 'EUR', add: { products: [ { name: 'Wireless Headphones', id: 'SKU-042', price: '149.00', brand: 'SoundCo', category: 'Electronics/Audio/Headphones', variant: 'Black', position: 3, quantity: 2, dimension1: 'Member', // custom dimension — passed through as-is metric1: '298.00' // custom metric — passed through as-is } ] } } }); ``` ```json // GTM Variable "GA4 – Items" (Mode: Items) returns: // [ // { // item_name: 'Wireless Headphones', // item_id: 'SKU-042', // price: 149, // item_brand: 'SoundCo', // item_category: 'Electronics', // item_category2: 'Audio', // item_category3: 'Headphones', // item_category4: undefined, // item_variant: 'Black', // item_list_name: undefined, // item_list_id: '', // index: 3, // quantity: 2, // currency: 'EUR', // dimension1: 'Member', // metric1: '298.00' // } // ] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.