An open-source, all-in-one platform combining web analytics, session replay, feature flags, and A/B testing for product teams to build successful products.
PostHog is an open-source, all-in-one platform for building successful products. It solves the problem of fragmented toolchains in modern product development. Traditionally, teams might need to use Google Analytics (traffic analysis), Mixpanel (product analytics), Hotjar (session replay), LaunchDarkly (feature flags), and Sentry (error tracking) simultaneously. PostHog integrates these capabilities into a single platform, providing a closed loop of data pipeline, analytics, and action.
- Data Sovereignty & Privacy: Supports self-hosted deployment to meet compliance requirements, keeping data within your domain
- Full Product Lifecycle Coverage: From initial traffic monitoring to in-depth user behavior analysis, to feature staged rollout and A/B testing, and finally to error monitoring and user feedback
- Developer-Friendly: Rich SDKs, SQL query interfaces, and APIs, with auto-capture events support to reduce instrumentation costs
| Module | Description |
|---|
| Product Analytics | Core analytics engine with auto-capture or manual event tracking; trends, funnels, retention, path analysis; HogQL (SQL-based dialect) for direct data queries |
| Web Analytics | Google Analytics-like dashboard focused on traffic monitoring, Web Vitals, and revenue tracking |
| LLM Analytics | Designed for AI applications, capturing LLM traces, generations, latency, and token costs |
| Module | Description |
|---|
| Session Replays | User session playback recording real user actions on web or mobile, combined with console logs for problem diagnosis |
| Error Tracking | Error tracking and monitoring, auto-capturing frontend/backend exceptions with grouping, alerts, and Session Replay integration |
| Module | Description |
|---|
| Feature Flags | Feature toggles supporting staged rollout by user ID, group, or percentage; high performance with SSR support |
| Experiments | A/B testing and multivariate testing measuring impact on core metrics; no-code configuration support |
| Surveys | Feedback collection with no-code templates or custom survey builder |
| Module | Description |
|---|
| Data Warehouse | Data warehouse integration syncing external data sources for combined queries with PostHog product data |
| Data Pipelines (CDP) | Customer data platform for real-time event forwarding to 25+ third-party tools or webhooks |
| Workflows | Automated workflows triggering messages or data flows based on events |
- 1M events/month
- 5k session recordings
- 1M feature flag requests
- 100k exceptions
- 1,500 survey responses
- Product managers analyzing user activation, retention, and conversion funnels
- Developers reproducing user error scenarios via Session Replay combined with Error Tracking
- Engineering teams implementing safe releases with Feature Flags and validating value with Experiments
- Data engineers syncing product data to data warehouses via Data Pipeline (CDP)
- AI teams monitoring LLM application call chains, costs, and latency
| Frontend | Mobile | Backend |
|---|
| JavaScript | React Native | Python |
| Next.js | Android | Node |
| React | iOS | PHP |
| Vue | Flutter | Ruby |
Additional support: Go, .NET/C#, Django, Angular, WordPress, Webflow, etc.
# Linux + Docker (4GB RAM recommended)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/posthog/posthog/HEAD/bin/deploy-hobby)"
<script>
!function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([].slice.call(arguments))}}(p=t.createElement("script")).type="text/javascript",p.crossOrigin="anonymous",p.async=!0,p.src=s.api_host+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},o="capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags getFeatureFlag getFeatureFlagValue reloadFeatureFlags group updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures getActiveMatchingSurveys getSurveys onSessionId".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]);
posthog.init('<YOUR_API_KEY>', {api_host: '<YOUR_HOST>'})
</script>
import posthog
posthog.capture('user_id', 'event_name', {'property': 'value'})
PostHog uses a large monorepo structure, transitioning from monolith to vertical slice architecture:
- Vertical Slicing: Each product has independent full-stack implementation (DB -> API -> UI), reducing cross-module coupling
- Module Boundary Constraints: Using
tach for Python module dependency checking and Turborepo for build dependency management
- HogQL: PostHog's core query layer, converting SQL-like syntax to ClickHouse queries
pyproject.toml - Python dependencies and tooling configuration
pnpm-workspace.yaml - Frontend monorepo configuration
docker-compose.hobby.yml - Self-hosted Docker Compose
turbo.json - Turborepo build configuration