Setup
- Create account at posthog.com
- Get project API key
- 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).