How do I track ecommerce events in GA4?
Applies to: Google Analytics 4 (GA4)
Last updated: May 2025
Problem
You run an online store and want to track ecommerce interactions such as product views, add-to-cart actions, purchases, and revenue in GA4.
Solution
GA4 supports ecommerce tracking using a set of recommended event names and structured parameters. You can implement these events using either the gtag.js snippet or Google Tag Manager, and they must be configured to send data in GA4’s expected format.
Key Ecommerce Events in GA4
| Event Name | Purpose |
|---|---|
view_item | Product detail view |
add_to_cart | Add product to cart |
begin_checkout | Checkout started |
add_payment_info | Payment method selection |
purchase | Successful transaction |
view_cart | Cart view |
remove_from_cart | Product removed from cart |
Step-by-Step Guide
1. Choose Your Implementation Method
You can track ecommerce events in GA4 using:
- gtag.js (direct JavaScript on your site)
- Google Tag Manager (more flexible and scalable)
For most users, Google Tag Manager is the preferred method.
2. Structure the Data Correctly
GA4 expects ecommerce data to be sent with specific parameters, such as:
gtag('event', 'purchase', {
currency: 'USD',
transaction_id: 'T12345',
value: 149.99,
tax: 10.00,
shipping: 5.00,
items: [
{
item_id: 'SKU_123',
item_name: 'T-Shirt',
quantity: 1,
price: 134.99
}
]
});
Each item in the items array can include optional fields like item_brand, item_category, coupon, etc.
3. Set Up Events in Google Tag Manager (Optional)
To configure a GA4 ecommerce event in GTM:
- Go to Tags > New
- Choose Google Analytics: GA4 Event
- Select your GA4 Configuration tag
- Name the event (e.g.,
purchase) - Add parameters in key-value format (e.g.,
transaction_id,value,items, etc.) - Set an appropriate Trigger, such as a page view or button click
Repeat this for other ecommerce events like add_to_cart or view_item.
4. Test Your Events
Use these tools to validate:
- GA4 DebugView (under Admin > DebugView)
- Google Tag Assistant Chrome extension
- GTM Preview mode
Verify that the right parameters are sent and values are correct.
Notes
- GA4 does not include built-in ecommerce reports like Universal Analytics did
- Use Explorations or connect GA4 to BigQuery for deeper analysis
- Ecommerce tracking requires technical implementation or a plugin/integration for your platform (e.g., Shopify, WooCommerce)




