observability monitoring⏱10 minutes
Get Started with PostHog
UnverifiedQuick Summary
“Open-source product analytics with session replay, flags, and experiments.”
Best for: Open-source product analytics
Time to first integration: 10 minutes
📋Prerequisites
- ✓Node.js 18+ installed
- ✓A PostHog account — sign up here
- ✓An existing project (Next.js, React, or Node.js recommended)
Setup Steps
4 steps1
1
Install
Add the PostHog JS SDK to your project.
bash
npm install posthog-js2
2
Initialize
Initialize with your project API key and host (from PostHog project settings).
typescript
import posthog from 'posthog-js'
posthog.init(apiKey, { api_host: 'https://us.i.posthog.com' })3
3
Capture events
Track custom events with properties.
typescript
posthog.capture('event_name', { property: 'value' })4
4
Verify
Confirm events appear in the PostHog activity view.
Links
PostHog Website↗Affiliate Link
Documentation↗