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

Turn your purchase events into revenue in the revenue setup wizard: pick your platform, follow the recommended install path, and TraceLog verifies it live. For custom stores that send their own events, the wizard uses event-based revenue — you map the value field in your event payload (e.g., total) and revenue is read from every order. See Revenue Tracking for the full flow, modes, and live verification.

Integrations

TraceLog integrates with popular e-commerce platforms:

  • Shopify -- server-side webhook + checkout funnel for Shopify stores
  • WooCommerce -- no-code plugin (or a developer PHP hook) for WooCommerce 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 Ask 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?"