PostHog is an open-source product analytics platform. It replaces Google Analytics, Mixpanel, and LaunchDarkly with a single self-hosted tool.
What Is PostHog?
PostHog provides analytics, session recording, feature flags, A/B testing, and surveys — all in one platform.
Free tier:
- 1M events/month
- 5K session recordings
- Unlimited feature flags
- Self-hosted: unlimited
REST API
# Capture event
curl -X POST https://app.posthog.com/capture/ \
-H "Content-Type: application/json" \
-d '{"api_key":"YOUR_PROJECT_KEY","event":"purchase","distinct_id":"user123","properties":{"amount":49.99,"product":"Pro Plan"}}'
# Query events
curl https://app.posthog.com/api/projects/PROJECT_ID/events/ \
-H "Authorization: Bearer YOUR_PERSONAL_API_KEY"
# Feature flags
curl -X POST https://app.posthog.com/decide/ \
-d '{"api_key":"YOUR_KEY","distinct_id":"user123"}'
JavaScript SDK
import posthog from "posthog-js";
posthog.init("YOUR_PROJECT_KEY", { api_host: "https://app.posthog.com" });
posthog.capture("button_clicked", { button: "signup" });
if (posthog.isFeatureEnabled("new-dashboard")) {
showNewDashboard();
}
Use Cases
- Product analytics — funnels, retention, paths
- Session recording — watch user sessions
- Feature flags — gradual rollouts
- A/B testing — experiment with variations
- Surveys — in-app feedback
PostHog vs Alternatives
| Feature | PostHog | Mixpanel | Amplitude |
|---|---|---|---|
| Self-hosted | Yes | No | No |
| Free events | 1M/mo | 20M/mo | 50M/mo |
| Session replay | Yes | No | Yes |
| Feature flags | Yes | No | Yes |
| Open source | Yes | No | No |
Need web data at scale? Check out my scraping tools on Apify or email spinov001@gmail.com for custom solutions.
Top comments (0)