DISCOVER THE FUTURE OF AI AGENTSarrow_forward

PostHog

calendar_todayAdded Feb 23, 2026
categoryAgent & Tooling
codeOpen Source
PythonTypeScriptReactPostgreSQLMachine LearningWeb ApplicationAgent & ToolingModel & Inference FrameworkDeveloper Tools & CodingData Analytics, BI & Visualization

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 Overview#

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.

Core Values#

  • 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

Feature Modules#

Analytics & Insights#

ModuleDescription
Product AnalyticsCore analytics engine with auto-capture or manual event tracking; trends, funnels, retention, path analysis; HogQL (SQL-based dialect) for direct data queries
Web AnalyticsGoogle Analytics-like dashboard focused on traffic monitoring, Web Vitals, and revenue tracking
LLM AnalyticsDesigned for AI applications, capturing LLM traces, generations, latency, and token costs

Experience & Debugging#

ModuleDescription
Session ReplaysUser session playback recording real user actions on web or mobile, combined with console logs for problem diagnosis
Error TrackingError tracking and monitoring, auto-capturing frontend/backend exceptions with grouping, alerts, and Session Replay integration

Release & Experimentation#

ModuleDescription
Feature FlagsFeature toggles supporting staged rollout by user ID, group, or percentage; high performance with SSR support
ExperimentsA/B testing and multivariate testing measuring impact on core metrics; no-code configuration support
SurveysFeedback collection with no-code templates or custom survey builder

Data Infrastructure#

ModuleDescription
Data WarehouseData 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
WorkflowsAutomated workflows triggering messages or data flows based on events

Free Tier (PostHog Cloud)#

  • 1M events/month
  • 5k session recordings
  • 1M feature flag requests
  • 100k exceptions
  • 1,500 survey responses

Use Cases#

  • 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

SDK Support Matrix#

FrontendMobileBackend
JavaScriptReact NativePython
Next.jsAndroidNode
ReactiOSPHP
VueFlutterRuby

Additional support: Go, .NET/C#, Django, Angular, WordPress, Webflow, etc.

Deployment Options#

Option 2: Self-hosted Hobby Deployment#

# Linux + Docker (4GB RAM recommended)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/posthog/posthog/HEAD/bin/deploy-hobby)"

Code Examples#

JavaScript Web Snippet#

<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>

Python SDK#

import posthog
posthog.capture('user_id', 'event_name', {'property': 'value'})

Architecture Principles#

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

Key Configuration Files#

  • 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

Related Projects

View All arrow_forward

STAY UPDATED

Get the latest AI tools and trends delivered straight to your inbox. No spam, just intelligence.

rocket_launch