This guide outlines how to add ecommerce events to your ecommerce site to make the most out of the ecommerce reports in Google Analytics.
Implementing these events will allow you to quantify your most popular products and see how promotions and product placement affects sales. For example, the following report shows average purchase revenue per user and purchases by item name:
For a list of all events and associated parameters, see the gtag.js Event reference.
Product impressions
To measure how products have been viewed, and how often users interact with them, use the following events:
By sending all of these events, your Google Analytics reports will paint a more accurate picture of how often products are seen. By creating funnels with these events combined with promotion data, you can also measure the effectiveness of your campaigns.
view_item_list
Send a view_item_list
event when a user is presented with a list of products.
Example
A user visits the home page and sees a list called "Related Products."
gtag('event', 'view_item_list', {
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
index: 5,
item_list_name: 'Related Products',
item_list_id: 'related_products',
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'black',
price: 9.99,
currency: 'USD',
quantity: 1
}],
item_list_name: 'Related products',
item_list_id: 'related_products'
});
See view_item_list
for documentation on each parameter.
view_item
Send a view_item
event when a user views a particular item.
Example
A user follows a link that goes directly to a product page. Take care not to
confuse this event with select_item
.
gtag('event', 'view_item', {
currency: 'USD',
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'black',
price: 9.99,
currency: 'USD',
quantity: 1
}],
value: 9.99
});
See view_item
for documentation on each parameter.
select_item
Send a select_item
event when a user directly interacts with a particular
item.
Example
After a product search, a user clicks on a product link. Take care not to
confuse this event with view_item
.
gtag('event', 'select_item', {
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
index: 5,
item_list_name: 'Related Products',
item_list_id: 'related_products',
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'black',
price: 9.99,
currency: 'USD',
quantity: 1
}],
item_list_name: 'Related products',
item_list_id: 'related_products'
});
See select_item
for documentation on each parameter.
Promotion impressions
To measure how promotions have been viewed, and how often users interact with them, use the following events:
By sending these events, your Google Analytics reports will paint a more accurate picture of how often promotions are seen. By creating funnels with these events combined with product data, you can also measure the effectiveness of your campaigns.
view_promotion
Send a view_promotion
event when a user views a particular promotion.
Example
A user scrolls by a banner showcasing a sale.
gtag('event', 'view_promotion', {
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
promotion_id: 'P_12345',
promotion_name: 'Summer Sale',
creative_slot: 'featured_app_1',
location_id: 'L_12345',
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'Black',
price: 9.99,
currency: 'USD',
quantity: 1
}],
location_id: 'L_12345'
});
See view_promotion
for documentation on each parameter.
select_promotion
Send a select_promotion
event when a user directly interacts with a particular
promotion.
Example
A user clicks on a banner showcasing a sale.
gtag('event', 'select_promotion', {
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
promotion_id: 'P_12345',
promotion_name: 'Summer Sale',
creative_name: 'Summer Banner',
creative_slot: 'featured_app_1',
location_id: 'L_12345',
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'Black',
price: 9.99,
currency: 'USD',
quantity: 1
}],
location_id: 'L_12345'
});
See select_promotion
for documentation on each parameter.
Pre-purchase interactions
To measure user behavior before checkout, use the following events:
By sending these events, your Google Analytics reports will paint a more accurate picture of item performance.
add_to_cart
Send an add_to_cart
event when a user adds an item to their cart.
Example
A user adds an item to their cart.
gtag('event', 'add_to_cart', {
currency: 'USD',
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'black',
price: 9.99,
currency: 'USD',
quantity: 1
}],
value: 7.77
});
See add_to_cart
for documentation on each parameter.
remove_from_cart
Send a remove_from_cart
event when a user removes an item from their cart.
Example
A user removes an item from their cart.
gtag('event', 'remove_from_cart', {
currency: 'USD',
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'black',
price: 9.99,
currency: 'USD',
quantity: 1
}],
value: 7.77
});
See remove_from_cart
for documentation on each parameter.
Purchases, checkouts, and refunds
To measure product purchases, use the following events:
By sending these events, your Google Analytics reports will paint a more accurate picture of item performance.
begin_checkout
Send a begin_checkout
event when a user starts the checkout process.
Example
A user begins the checkout process.
gtag('event', 'begin_checkout', {
coupon: 'SUMMER_FUN',
currency: 'USD',
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'black',
price: 9.99,
currency: 'USD',
quantity: 1
}],
value: 7.77
});
See begin_checkout
for documentation on each parameter.
add_payment_info
Send an add_payment_info
event when a user adds their payment info during the
checkout process.
Example
A user adds their payment info during the checkout process.
gtag('event', 'add_payment_info', {
coupon: 'SUMMER_FUN',
currency: 'USD',
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'black',
price: 9.99,
currency: 'USD',
quantity: 1
}],
payment_type: 'Credit Card',
value: 9.99
});
See add_payment_info
for documentation on each parameter.
add_shipping_info
Send an add_shipping_info
event when a user adds their shipping information
during the checkout process.
Example
A user adds their shipping information during the checkout process.
gtag('event', 'add_shipping_info', {
coupon: 'SUMMER_FUN',
currency: 'USD',
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'Black',
price: 9.99,
currency: 'USD',
quantity: 1
}],
shipping_tier: 'Ground',
value: 7.77
});
See add_shipping_info
for documentation on each parameter.
purchase
Send a purchase
event when a user completes the purchase process.
Example
A user completes the purchase process.
gtag('event', 'purchase', {
affiliation: 'Google Store',
coupon: 'SUMMER_FUN',
currency: 'USD',
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'black',
price: 9.99,
currency: 'USD',
quantity: 1
}, {
item_id: 'SKU_12346',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'gray',
price: 9.99,
currency: 'USD',
quantity: 1
}],
transaction_id: 'T_12345',
shipping: 3.33,
value: 21.09,
tax: 2.22
})
See purchase
for documentation on each parameter.
refund
Send a refund
event when a user requests a refund. The are two supported types
of refunds:
- Partial refunds - Use this format when only some of the purchased items are refunded.
- Full refunds - Use this format when all of the purchased items are refunded.
Partial refund example
A user requests a partial refund.
gtag('event', 'refund', {
affiliation: 'Google Store',
coupon: 'SUMMER_FUN',
currency: 'USD',
items: [{
item_id: 'SKU_12345',
item_name: 'jeggings',
coupon: 'SUMMER_FUN',
discount: 2.22,
affiliation: 'Google Store',
item_brand: 'Gucci',
item_category: 'pants',
item_variant: 'black',
price: 9.99,
currency: 'USD',
quantity: 1
}],
transaction_id: 'T_12345',
shipping: 3.33,
value: 12.21,
tax: 1.11
});
See refund
for documentation on each parameter.
Full refund example
A user requests a full refund.
gtag('event', 'refund', {
affiliation: 'Google Store',
coupon: 'SUMMER_FUN',
currency: 'USD',
transaction_id: 'T_12345',
shipping: 3.33,
value: 12.21,
tax: 1.11
});
See refund
for documentation on each parameter.