PostHog is an open-source product analytics platform. Track events, feature flags, A/B tests, session recordings, and surveys — all in one tool. Self-host or use cloud.
Quick Start
npm install posthog-js
import posthog from 'posthog-js'
posthog.init('your-api-key', { api_host: 'https://app.posthog.com' })
// Track events
posthog.capture('button_clicked', { button: 'signup', page: '/pricing' })
// Identify users
posthog.identify('user-123', { name: 'John', plan: 'pro' })
Feature Flags
// Check flag
if (posthog.isFeatureEnabled('new-dashboard')) {
showNewDashboard()
} else {
showOldDashboard()
}
// Flag with payload
const config = posthog.getFeatureFlagPayload('pricing-test')
// { variant: 'B', price: 29 }
Session Replay
Enabled by default. Watch real user sessions:
- Click heatmaps
- Scroll depth
- Rage clicks
- Network requests
No extra code needed.
Free Tier
- 1M events/month
- 5K session recordings/month
- Unlimited feature flags
- Self-host: unlimited everything
PostHog vs Mixpanel vs Amplitude
| Feature | PostHog | Mixpanel | Amplitude |
|---|---|---|---|
| Open source | Yes | No | No |
| Self-host | Yes | No | No |
| Session replay | Yes | No | Yes |
| Feature flags | Yes | No | No |
| A/B tests | Yes | No | Yes |
| Free tier | 1M events | 20M events | 10M events |
The Bottom Line
PostHog replaces 4-5 tools: analytics + feature flags + A/B tests + session replay + surveys. Open source, generous free tier, self-hostable.
Need to automate data collection or build custom scrapers? Check out my Apify actors for ready-made tools, or email spinov001@gmail.com for custom solutions.
Top comments (0)