Skip to main content

Setup

  1. Create account at posthog.com
  2. Get project API key
  3. Add to .env.local:
NEXT_PUBLIC_POSTHOG_KEY=phc_xxxxx
NEXT_PUBLIC_POSTHOG_HOST=https://app.posthog.com

Events Tracked

Store Views

posthog.capture('store_view', {
  store_id: store.id,
  subdomain: store.subdomain
});

Product Views

posthog.capture('product_view', {
  product_id: product.id,
  product_name: product.title,
  price: product.price
});

Order Events

  • order_started
  • order_details_filled
  • order_placed
  • order_abandoned

Funnels

Track conversion funnels:
Store View → Product View → Cart Add → Checkout → Order Placed
PostHog is used in both web store (buyer analytics) and iOS app (seller analytics).