Skip to content

Measuring Ecommerce with Google Analytics

Google Analytics provides powerful tools for measuring the performance of your ecommerce website. By implementing ecommerce tracking, you can gain valuable insights into your sales funnel, customer behavior, and revenue generation. Below, we'll explore how to effectively measure ecommerce performance using Google Analytics.

Set Up Google Analytics 4

Before you can measure ecommerce performance, you need to create a Google Analytics 4 account and property.

Then you need to create a web data stream for your website. This will allow you to collect data from your site and track user interactions.

Web Data Stream

After you've set up your web data stream, you will have a Google Tag Manager code snippet. Go to Admin -> Settings -> Ecommerce -> Tracking, enable Enable Google Tag Manager field and paste your Google Tag Manager code snippet in the Google Tag Manager code field.

Admin Settings

Tracked Events

The following GA4 ecommerce events are tracked automatically:

Server-Side Events

These events are pushed from the server when pages load:

EventTriggerData
view_item_listProduct listing page (category, search results)item_list_id, item_list_name, items with item_id, item_name, price, item_brand, item_category
view_itemProduct detail pagecurrency, value, item details
view_categoryCategory pagecategoryId, categoryName, productCount
view_cartCart pagecurrency, value, all cart items with quantities and variants
begin_checkoutCheckout pagecurrency, value, coupon, cart items
purchaseOrder success pagetransaction_id, currency, value, tax, shipping, coupon, ordered items
refundOrder refund processedtransaction_id, currency, value, tax, shipping, coupon, refunded items
searchSearch results pagesearch_term, items
sign_upAfter customer registrationmethod (email)

Client-Side Events

These events fire via JavaScript when users interact with the site:

EventTriggerData
add_to_cartClick add-to-cart buttoncurrency, value, item with item_id, item_name, price, quantity, item_brand, categories
remove_from_cartRemove item from cartcurrency, value, item details
select_itemClick on a product linkitem_list_id, item_list_name, item with index
add_to_wishlistAdd product to wishlistcurrency, value, item details
remove_from_wishlistRemove product from wishlistcurrency, value, item details
add_to_compareAdd product to compare listcurrency, value, item details
remove_from_compareRemove product from comparecurrency, value, item details
view_promotionPromotion banner visiblepromotion_id, promotion_name, creative_name, creative_slot, location_id, items
select_promotionClick on a promotion bannerpromotion_id, promotion_name, creative_name, creative_slot, location_id
searchAJAX quick search or search form submitsearch_term, result_count
scrollUser scrolls 25%, 50%, 75%, 90% of pagepercent_scrolled
user_engagementUser on page for 10s, 30s, 60s, 2m, 3mengagement_time_msec

Item Data Structure

Each item in the events contains:

FieldDescription
item_idProduct SKU or ID
item_nameProduct name
priceProduct price
quantityQuantity (when applicable)
item_brandBrand name
item_categoryPrimary category
item_category2, item_category3, ...Additional categories
item_variantVariant attributes (cart items only)

See Your Ecommerce Data

After 24 hours, your ecommerce data will be available in your Google Analytics account. You can view your ecommerce data by reading the Ecommerce purchases report.

Ecommerce data

Debugging

Google Analytics provides a debug mode to help you verify that your ecommerce tracking is working correctly.

You can add , { debug_mode: true } after your gtag('config', 'G-XXXXXXXXXXX'); code snippet to enable debug mode.

js
gtag('config', 'TAG_ID', { debug_mode: true });

Example code snippet

Once you've enabled debug mode, you can use the DebugView by following Google's instructions.

DebugView