E-commerce event tracking in GA4 relies on a well-structured data layer. This is typically populated by your e-commerce platform or custom code.
• Use the GA4 e-commerce schema for consistency.
• For platforms like WooCommerce, Magento, Shopify, or Shopware, use official plugins or extensions to inject the correct data layer.
To send e-commerce details to GA4, you need to create variables that extract values from the data layer:
• event description: User views a product list
• required parameters: items (each item must have item_id, item_name price)
• optional parameters: item_list_id, item_list_name, index, item_brand, item_category(1–5), item_variant
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "view_item_list",
ecommerce: {
item_list_id: "taggrs_collection",
item_list_name: "TAGGRS Collection",
items: [
{
item_id: "T123",
item_name: "Tee",
item_brand: "TAGGRS",
item_category: "Apparel",
item_variant: "Blue",
price: 19.99,
index: 0
}
]
}
});
• Tag type: Google Analytics: GA4 Event
• Event Name: view_item_list
• Data Layer Variables (Name - Data Layer Variable Name):
Event Parameters (Parameter Name - Value):
Trigger configuration:
• event description: User selects a product from a list
• required parameters: items (must include at least one item with item_id, item_name, price)
• optional parameters: item_list_id, item_list_name, index, item_brand, item_category(1–5), item_variant
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "select_item",
ecommerce: {
item_list_id: "taggrs_collection",
item_list_name: "TAGGRS Collection",
items: [
{
item_id: "T123",
item_name: "Tee",
item_brand: "TAGGRS",
item_category: "Apparel",
item_variant: "Blue",
price: 19.99,
index: 0
}
]
}
});• Tag type: Google Analytics: GA4 Event
• Event Name: select_item
• Data Layer Variables (Name - Data Layer Variable Name):
Event Parameters (Parameter Name - Value):
Trigger configuration:
• event description: User views a product detail page
• required parameters: items (single item with item_id, item_name, price), value, currency
• optional parameters: item_brand, item_category(1–5), item_variant
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "view_item",
ecommerce: {
currency: "EUR",
value: 19.99,
items: [
{
item_id: "T123",
item_name: "Tee",
item_brand: "TAGGRS",
item_category: "Apparel",
item_variant: "Blue",
price: 19.99
}
]
}
});• Tag type: Google Analytics: GA4 Event
• Event Name: view_item
• Data Layer Variables (Name - Data Layer Variable Name):
Event Parameters (Parameter Name - Value):
Trigger configuration:
• event description: User adds a product to the shopping cart
• required parameters: value, currency, items (with item_id, item_name, quantity, price)
• optional parameters: item_brand, item_category(1–5), item_variant
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "add_to_cart",
ecommerce: {
currency: "EUR",
value: 19.99,
items: [
{
item_id: "T123",
item_name: "Tee",
item_brand: "TAGGRS",
item_category: "Apparel",
item_variant: "Blue",
price: 19.99,
quantity: 1
}
]
}
});• Tag type: Google Analytics: GA4 Event
• Event Name: add_to_cart
• Data Layer Variables (Name - Data Layer Variable Name):
Event Parameters (Parameter Name - Value):
Trigger configuration:
• event description: User removes a product from the shopping cart
• required parameters: currency, value, items (with item_id, item_name, quantity, price)
• optional parameters: item_brand, item_category(1–5), item_variant
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "remove_from_cart",
ecommerce: {
currency: "EUR",
value: 19.99,
items: [
{
item_id: "T123",
item_name: "Tee",
item_brand: "TAGGRS",
item_category: "Apparel",
item_variant: "Blue",
price: 19.99,
quantity: 1
}
]
}
});• Tag type: Google Analytics: GA4 Event
• Event Name: add_to_cart
• Data Layer Variables (Name - Data Layer Variable Name):
Event Parameters (Parameter Name - Value):
Trigger configuration:
• event description: User views the shopping cart
• required parameters: currency, value, items (with item_id, item_name, quantity, price)
• optional parameters: item_brand, item_category(1–5), item_variant
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "view_cart",
ecommerce: {
currency: "EUR",
value: 19.99,
items: [
{
item_id: "T123",
item_name: "Tee",
item_brand: "TAGGRS",
item_category: "Apparel",
item_variant: "Blue",
price: 19.99,
quantity: 1
}
]
}
});• Tag type: Google Analytics: GA4 Event
• Event Name: view_cart
• Data Layer Variables (Name - Data Layer Variable Name):
Event Parameters (Parameter Name - Value):
Trigger configuration:
• event description: User adds a product to a wishlist
• required parameters: currency, value, items (with item_id, item_name, quantity, price)
• optional parameters: item_brand, item_category(1–5), item_variant
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "add_to_wishlist",
ecommerce: {
currency: "EUR",
value: 19.99,
items: [
{
item_id: "T123",
item_name: "Tee",
item_brand: "TAGGRS",
item_category: "Apparel",
item_variant: "Blue",
price: 19.99,
quantity: 1
}
]
}
});• Tag type: Google Analytics: GA4 Event
• Event Name: add_to_wishlist
• Data Layer Variables (Name - Data Layer Variable Name):
Event Parameters (Parameter Name - Value):
Trigger configuration:
• event description: User initiates the checkout process
• required parameters: currency, value, items (with item_id, item_name, quantity, price)
• optional parameters: item_brand, item_category(1–5), item_variant
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "begin_checkout",
ecommerce: {
currency: "EUR",
value: 19.99,
items: [
{
item_id: "T123",
item_name: "Tee",
item_brand: "TAGGRS",
item_category: "Apparel",
item_variant: "Blue",
price: 19.99,
quantity: 1
}
]
}
});• Tag type: Google Analytics: GA4 Event
• Event Name: begin_checkout
• Data Layer Variables (Name - Data Layer Variable Name):
Event Parameters (Parameter Name - Value):
Trigger configuration:
• event description: User selects a shipping option
• required parameters: currency, value, items (with item_id, item_name, quantity, price)
• optional parameters: item_brand, item_category(1–5), item_variant
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "add_shipping_info",
ecommerce: {
currency: "EUR",
value: 24.99,
shipping_tier: "Standard Shipping",
items: [
{
item_id: "T123",
item_name: "Tee",
item_brand: "TAGGRS",
item_category: "Apparel",
item_variant: "Blue",
price: 19.99,
quantity: 1
}
]
}
});• Tag type: Google Analytics: GA4 Event
• Event Name: add_shipping_info
• Data Layer Variables (Name - Data Layer Variable Name):
Event Parameters (Parameter Name - Value):
Trigger configuration:
• event description: User selects a shipping option
• required parameters: currency, value, items (with item_id, item_name, quantity, price)
• optional parameters: item_brand, item_category(1–5), item_variant
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "add_payment_info",
ecommerce: {
currency: "EUR",
value: 24.99,
payment_type: "credit_card",
items: [
{
item_id: "T123",
item_name: "Tee",
item_brand: "TAGGRS",
item_category: "Apparel",
item_variant: "Blue",
price: 19.99,
quantity: 1
}
]
}
});• Tag type: Google Analytics: GA4 Event
• Event Name: add_shipping_info
• Data Layer Variables (Name - Data Layer Variable Name):
Event Parameters (Parameter Name - Value):
Trigger configuration:
• event description: User completes a purchase
• required parameters: currency, value, items (with item_id, item_name, quantity, price)
• optional parameters: item_brand, item_category(1–5), item_variant
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "purchase",
ecommerce: {
transaction_id: "T_12345",
affiliation: "Online Store",
value: 24.99,
tax: 5.00,
shipping: 5.00,
currency: "EUR",
coupon: "TAGGRS10",
items: [
{
item_id: "T123",
item_name: "Tee",
item_brand: "TAGGRS",
item_category: "Apparel",
item_variant: "Blue",
price: 19.99,
quantity: 1
}
]
}
});• Tag type: Google Analytics: GA4 Event
• Event Name: purchase
• Data Layer Variables (Name - Data Layer Variable Name):
Event Parameters (Parameter Name - Value):
Trigger configuration:
• event description: User receives a refund
• required parameters: transaction_id
• optional parameters: items (for partial refunds), currency, value
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "refund",
ecommerce: {
transaction_id: "T_12345",
value: 19.99,
currency: "EUR",
items: [
{
item_id: "T123",
item_name: "Tee",
item_brand: "TAGGRS",
item_category: "Apparel",
item_variant: "Blue",
price: 19.99,
quantity: 1
}
]
}
});• Tag type: Google Analytics: GA4 Event
• Event Name: refund
• Data Layer Variables (Name - Data Layer Variable Name):
Event Parameters (Parameter Name - Value):
Trigger configuration:
• event description: User views an internal promotion
• required parameters: items (with item_id, item_name, quantity, price), promotion_id, promotion_name
• optional parameters: creative_name, creative_slot, location_id
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "view_promotion",
ecommerce: {
creative_name: "TAGGRS Banner",
creative_slot: "featured_app_1",
promotion_id: "P_12345",
promotion_name: "TAGGRS Sale",
items: [
{
item_id: "T_123",
item_name: "TAGGRS Tee",
item_brand: "TAGGRS",
item_category: "Apparel",
item_list_id: "related_products",
item_list_name: "Related Products",
item_variant: "green",
price: 10.01,
quantity: 3
}
]
}
});• Tag type: Google Analytics: GA4 Event
• Event Name: view_promotion
• Data Layer Variables (Name - Data Layer Variable Name):
Event Parameters (Parameter Name - Value):
Trigger configuration:
• event description: User clicks or selects a promotion
• required parameters: items (each with item_id, item_name, quantity, price), promotion_id, promotion_name
• optional parameters: creative_name, creative_slot, location_id
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "select_promotion",
ecommerce: {
creative_name: "TAGGRS Banner",
creative_slot: "featured_app_1",
promotion_id: "P_12345",
promotion_name: "TAGGRS Sale",
items: [
{
item_id: "T_123",
item_name: "TAGGRS Tee",
item_brand: "TAGGRS",
item_category: "Apparel",
item_list_id: "related_products",
item_list_name: "Related Products",
item_variant: "green",
price: 10.01,
quantity: 3
}
]
}
});• Tag type: Google Analytics: GA4 Event
• Event Name: select_promotion
• Data Layer Variables (Name - Data Layer Variable Name):
Event Parameters (Parameter Name - Value):
Trigger configuration:
Before publishing, it’s important to confirm that your GA4 e-commerce tracking works as expected. T dos, please follow the net 6 steps:
• Click Preview in the top-right corner of Google Tag Manager.
• Enter your website’s URL and click Connect. This will open your site in a new tab and connect it to the Tag Assistant.
Perform actions on your site that should trigger e-commerce events, such as:
• Viewing a product (view_item)
• Adding a product to the cart (add_to_cart)
• Beginning checkout (begin_checkout)
• Completing a purchase (purchase)
In the Tag Assistant window, verify that the correct tags fire for each event.
• Open each triggered tag to ensure the correct parameters (like items, value, currency, and transaction_id) are being sent.
• If parameters are missing or incorrectly formatted, review your data layer setup and tag configuration.
• In GA4, navigate to Admin → DebugView.
• Make sure your events appear in real time and check that event names and parameters match your expected schema.
• Use this to confirm the end-to-end connection between your GTM container and GA4 property.
• If events don’t appear in DebugView, ensure the GA4 Configuration Tag is firing before your e-commerce event tags.
• Double-check data layer variables and trigger conditions.
• Once all e-commerce events are firing correctly and data is visible in DebugView, click Submit in GTM.
• Add a clear version name and description (e.g., “GA4 e-commerce setup – verified in DebugView”), then click Publish.