Overview
E-commerce tracking helps you understand how customers shop, where they drop off, and what drives purchases. Grain provides template events specifically designed for online stores.Key Metrics to Track
Conversion Funnel:- Product views → Add to cart → Checkout → Purchase
- Search behavior and results
- Product browsing patterns
- Cart interactions
- Order values and items
- Payment methods
- Discount code usage
Product View Tracking
Track when users view products:Add to Cart
Track cart additions to measure interest:Remove from Cart
Track when items are removed:Checkout Tracking
Track the entire checkout process:Purchase Completion
Track successful purchases:Complete Shopping Flow
Here’s a full example tracking the customer journey:Abandoned Cart Recovery
Track cart abandonment to understand drop-off:Discount Code Tracking
Track promotion usage:Analyzing the Funnel
With these events, you can analyze your funnel:- View to Cart:
product_viewed→add_to_cart - Cart to Checkout:
add_to_cart→checkout - Checkout to Purchase:
checkout→purchase
Best Practices
1. Track Early: Capture events as soon as actions happen. 2. Include Context: Always add product IDs, prices, and quantities. 3. Flush Critical Events: Useflush: true for purchases and checkouts.
4. Consistent Currency: Always specify currency codes (USD, EUR, etc.).
5. Full Item Details: Include complete item information for better analysis.