PostHog
PostHog analytics integration.
Updated
On this page
Overview
PostHog provides product analytics, session recordings, feature flags, and A/B testing. DashForDevs integrates natively with PostHog for detailed storefront analytics.
Setup
- Create a PostHog project at posthog.com
- Copy your project API key
- Go to Settings → Analytics in the dashboard
- Paste your PostHog API key
- Save
Automatic Integration
The SDK's tracking module automatically sends events to PostHog when configured:
import dash from "@/lib/dash"
// Initialize tracking (loads PostHog automatically)
await dash.tracking.init()
// All tracking events go to PostHog
dash.tracking.capture("viewed_product", { product: "Blue Dream" })
dash.tracking.identify("cust_abc123", { email: "customer@example.com" })
Debug Mode
// Show debug overlay
dash.tracking.debug()
Next Steps
- Storefront Views — Built-in view tracking
- UTM Tracking — Campaign attribution