Skip to main content

E-commerce Analytics

This guide covers how to set up TraceLog for an e-commerce site -- tracking product views, cart activity, checkout, and purchases.

Key Events to Track

EventWhen to Fire
product_viewedUser views a product detail page
product_added_to_cartUser adds an item to cart
checkout_startedUser begins the checkout process
purchase_completedUser completes a purchase

Code Examples

Product Browsing

tracelog.event('product_viewed', {
productId: 'SKU-001',
category: 'shoes',
price: 89.99,
currency: 'USD'
});

Cart Activity

tracelog.event('product_added_to_cart', {
productId: 'SKU-001',
quantity: 1,
price: 89.99
});

Checkout and Purchase

tracelog.event('checkout_started', {
itemCount: 3,
cartTotal: 249.97,
currency: 'USD'
});

tracelog.event('purchase_completed', {
orderId: 'ORD-789',
total: 249.97,
currency: 'USD',
itemCount: 3
});

Revenue Tracking

To aggregate revenue data in your dashboard:

  1. Go to Project Settings > Revenue
  2. Select the Transactional revenue model (one-time purchases)
  3. Map the revenue field from your event metadata (e.g., total)

Integrations

TraceLog integrates with popular e-commerce platforms:

  • Shopify -- automatic event tracking for Shopify stores
  • Stripe -- webhook-based purchase and subscription tracking

Create a purchase funnel to visualize your checkout flow:

  1. Product view (Page View: /products/*)
  2. Add to cart (Custom Event: product_added_to_cart)
  3. Checkout (Custom Event: checkout_started)
  4. Purchase (Custom Event: purchase_completed)

This shows you exactly where shoppers drop off and which step needs the most attention.

Dashboard Features to Use

  • Goals -- set purchase_completed as your primary conversion to track conversion rate across all dashboards
  • Campaign performance -- see which traffic sources and ad campaigns drive the most revenue
  • Visitor segments -- compare purchasing behavior between new and returning visitors

Example Copilot Questions

  • "What's my conversion rate by traffic source?"
  • "Which products have the highest cart abandonment?"
  • "How does weekend revenue compare to weekdays?"
  • "What's my average order value this month?"