E-commerce Events Implementation Guide
File Placement in Stencil Theme
Section titled “File Placement in Stencil Theme”Cart & Checkout Events
Section titled “Cart & Checkout Events”| Event | Template File | Implementation |
|---|---|---|
| Cart Viewed | templates/pages/cart.html | Add script at bottom of template |
| Product Removed | templates/pages/cart.html | Include with Cart Viewed script |
| Checkout Started | templates/pages/checkout.html or first checkout step | Add script at bottom |
| Checkout Steps | Various checkout templates | Call trackCheckoutStep() function |
| Payment Info | Payment step template | Call trackPaymentInfo() on form completion |
| Shipping Info | Shipping step template | Call trackShippingInfo() on form completion |
Product Discovery Events
Section titled “Product Discovery Events”| Event | Template File | Implementation |
|---|---|---|
| Product Clicked | templates/pages/category.htmltemplates/pages/search.htmltemplates/pages/brand.html | Add script to all product listing pages |
| Product List Viewed | Same as Product Clicked | Include with Product Clicked script |
| Products Searched | templates/pages/search.html | Add script at bottom of search template |
Transaction Events
Section titled “Transaction Events”| Event | Template File | Implementation |
|---|---|---|
| Order Completed | templates/pages/order-confirmation.html | Add script at bottom of confirmation page |
GTM Trigger Setup
Section titled “GTM Trigger Setup”Create These Custom Event Triggers
Section titled “Create These Custom Event Triggers”| Event Name | Trigger Name | Additional Conditions |
|---|---|---|
cart_viewed | Cart Viewed | - |
product_removed | Product Removed | - |
checkout_started | Checkout Started | - |
checkout_step_viewed | Checkout Step Viewed | - |
checkout_step_completed | Checkout Step Completed | - |
payment_info_entered | Payment Info Entered | - |
shipping_info_entered | Shipping Info Entered | - |
product_clicked | Product Clicked | - |
product_list_viewed | Product List Viewed | - |
products_searched | Products Searched | - |
order_completed | Order Completed | - |
| Remarketing Events | ||
remarketing_cart | Remarketing - Cart | {{dlv - ecomm_pagetype}} equals cart |
remarketing_checkout | Remarketing - Checkout | {{dlv - ecomm_pagetype}} equals purchase |
remarketing_browse | Remarketing - Browse | {{dlv - ecomm_pagetype}} equals searchresults |
remarketing_search | Remarketing - Search | {{dlv - ecomm_pagetype}} equals searchresults |
remarketing_conversion | Remarketing - Conversion | {{dlv - ecomm_pagetype}} equals conversion |
Required GTM Variables
Section titled “Required GTM Variables”Create these Data Layer Variables in GTM:
Core Variables
Section titled “Core Variables”dlv - value→valuedlv - currency→currencydlv - items→itemsdlv - ecomm_pagetype→ecomm_pagetypedlv - ecomm_totalvalue→ecomm_totalvaluedlv - google_tag_params→google_tag_params
Event-Specific Variables
Section titled “Event-Specific Variables”dlv - cart_id→cart_iddlv - checkout_id→checkout_iddlv - order_id→order_iddlv - transaction_id→transaction_iddlv - list_name→list_namedlv - query→querydlv - results_count→results_countdlv - step→stepdlv - step_name→step_name
Tag Configuration Examples
Section titled “Tag Configuration Examples”Google Ads Remarketing Tags
Section titled “Google Ads Remarketing Tags”Cart/Checkout Remarketing:
- Trigger:
remarketing_cartORremarketing_checkout - Event Name:
add_to_cartorbegin_checkout - Event Value:
{{dlv - ecomm_totalvalue}} - Custom Parameters:
{{dlv - google_tag_params}}
Browse/Search Remarketing:
- Trigger:
remarketing_browseORremarketing_search - Event Name:
view_item_listorsearch - Custom Parameters:
{{dlv - google_tag_params}}
Conversion Remarketing:
- Trigger:
remarketing_conversion - Event Name:
purchase - Event Value:
{{dlv - ecomm_totalvalue}} - Custom Parameters:
{{dlv - google_tag_params}}
GA4 Enhanced Ecommerce Tags
Section titled “GA4 Enhanced Ecommerce Tags”Standard Events:
- view_cart → Trigger:
cart_viewed - remove_from_cart → Trigger:
product_removed - begin_checkout → Trigger:
checkout_started - add_payment_info → Trigger:
payment_info_entered - add_shipping_info → Trigger:
shipping_info_entered - select_item → Trigger:
product_clicked - view_item_list → Trigger:
product_list_viewed - search → Trigger:
products_searched - purchase → Trigger:
order_completed
Segment Tags
Section titled “Segment Tags”Create Custom HTML tags for each Segment event that fires on the corresponding trigger.
Testing Checklist
Section titled “Testing Checklist”Product Discovery
Section titled “Product Discovery”- Browse category page →
product_list_viewedfires - Click product from category →
product_clickedfires - Search for products →
products_searchedfires - Click product from search →
product_clickedfires
Cart & Checkout
Section titled “Cart & Checkout”- View cart page →
cart_viewedfires - Remove item from cart →
product_removedfires - Start checkout →
checkout_startedfires - Complete checkout steps → step events fire
- Enter payment info →
payment_info_enteredfires - Enter shipping info →
shipping_info_enteredfires
Conversion
Section titled “Conversion”- Complete order →
order_completedfires - All remarketing events have correct
ecomm_pagetype - GA4 events have proper
itemsarrays - Google Ads gets proper conversion data
Performance Notes
Section titled “Performance Notes”Page Load Impact
Section titled “Page Load Impact”- Product pages: Minimal (existing setup)
- Cart page: Low impact (1 script)
- Category pages: Medium impact (click tracking)
- Checkout pages: Low impact (step tracking)
Data Accuracy
Section titled “Data Accuracy”- All events include proper product identifiers (SKU)
- Cart values are consistent across all events
- Category hierarchy reflects your BigCommerce setup
- Google Product Category fallback prevents empty values
Remarketing Optimization
Section titled “Remarketing Optimization”- Browse behavior:
dynx_pagetype: 'searchresults' - Purchase intent:
dynx_pagetype: 'conversionintent' - High intent:
dynx_pagetype: 'offerdetail' - Conversion:
dynx_pagetype: 'conversion'
This creates highly targeted remarketing audiences for optimal Google Ads bidding!