> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt # Getting started with Product Analytics ## Capture your first event To get started with [Product Analytics](/docs/product-analytics.md), the first step is to install the PostHog SDK to start capturing events within your application. Autocapture is on by default. Pageviews, clicks, form submissions, and session data are tracked automatically. Call `posthog.capture()` to capture custom events and properties. JavaScript ```javascript posthog.capture('signup_completed', { plan: 'pro' }) ``` - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/js.svg)Web](/docs/product-analytics/installation/web.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/frameworks/nextjs.svg)Next.js](/docs/libraries/next-js.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/react.svg)React Native](/docs/product-analytics/installation/react-native.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/react.svg)React](/docs/product-analytics/installation/react.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/nodejs.svg)Node.js](/docs/product-analytics/installation/nodejs.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/flutter.svg)Flutter](/docs/product-analytics/installation/flutter.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/python.svg)Python](/docs/product-analytics/installation/python.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/php.svg)PHP](/docs/product-analytics/installation/php.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/ruby.svg)Ruby](/docs/product-analytics/installation/ruby.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/go.svg)Go](/docs/product-analytics/installation/go.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/Android_robot_bec2fb7318.svg)Android](/docs/product-analytics/installation/android.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/ios.svg)iOS](/docs/product-analytics/installation/ios.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/java.svg)Java](/docs/product-analytics/installation/java.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/rust.svg)Rust](/docs/product-analytics/installation/rust.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/elixir.svg)Elixir](/docs/product-analytics/installation/elixir.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/kmp.svg)Kotlin Multiplatform](/docs/product-analytics/installation/kmp.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/dotnet_logo_7e446176f2.svg).NET](/docs/product-analytics/installation/dotnet.md) - [API](/docs/product-analytics/installation/api.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/docs/integrate/frameworks/angular.svg)Angular](/docs/libraries/angular.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/astro_icon_dark_23a13977ad.svg)Astro](/docs/libraries/astro.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/cloudflare_icon_ef34353f85.svg)Cloudflare Workers](/docs/libraries/cloudflare-workers.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/convex_d8dcddcd63.svg)Convex](/docs/libraries/convex.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/docs/integrate/frameworks/django.svg)Django](/docs/libraries/django.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/frameworks/docusaurus.svg)Docusaurus](/docs/libraries/docusaurus.md) - [Fastify](/docs/libraries/fastify.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/docs/integrate/frameworks/flask.svg)Flask](/docs/libraries/flask.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/frameworks/gatsby.svg)Gatsby](/docs/libraries/gatsby.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/hono_9d80c0611c.svg)Hono](/docs/libraries/hono.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/nestjs_logo_034b054f38.svg)NestJS](/docs/libraries/nestjs.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/docs/integrate/frameworks/laravel.svg)Laravel](/docs/libraries/laravel.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/frameworks/nuxt.svg)Nuxt.js](/docs/libraries/nuxt-js.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/Phoenix_Framework_81f5da0296.svg)Phoenix](/docs/libraries/phoenix.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/rails_581d31c82d.svg)Ruby on Rails](/docs/libraries/ruby-on-rails.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/react.svg)React Router](/docs/libraries/react-router.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/remix_letter_glowing_49183adce2.svg)Remix](/docs/libraries/remix.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/docs/integrate/frameworks/svelte.svg)Svelte](/docs/libraries/svelte.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/q_auto,f_auto/logo_color_600_391d28faae.png)TanStack Start](/docs/libraries/tanstack-start.md) - [![](https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/docs/integrate/frameworks/vue.svg)Vue.js](/docs/libraries/vue-js.md) For a customized setup, run the [AI wizard](/docs/ai-engineering/ai-wizard.md) with one command to automatically set up autocapture, custom events, and more. `npx @posthog/wizard` [Install PostHog](/docs/product-analytics/installation/ai-wizard.md) ## Create insights and dashboards With PostHog connected, your app automatically sends events. Query the full event stream to analyze product data and user behavior. You can combine related events into actions to create any kind of metric you need. Create insights and dashboards to visualize trends, funnels, and retention. ![Example of a dashboard](https://res.cloudinary.com/dmukukwp6/image/upload/dashboard_light_61b3bab3b6.png) You can also query your event data with [SQL](/docs/data-warehouse/query.md) if you need more flexibility. [Create insights](/docs/product-analytics/insights.md) ## Identify users and groups Linking events to specific users enables you to build a full picture of how they're using your product across different sessions, devices, and platforms. JavaScript ```javascript posthog.identify( 'max@hedgehogmail.com', // user's unique identifier { name: 'Max Hedgehog' } // additional person properties ); ``` You can also aggregate events into groups to track organization behavior at the company, team, or project level. JavaScript ```javascript posthog.group( 'company', 'company_id_in_your_db', { name: 'PostHog' } // additional group properties ); ``` [Identify users](/docs/product-analytics/identify.md) ## Anaylze data with MCP and AI Use AI to investigate and conduct data analysis for you. Connect the PostHog MCP server to let agents query your data and run analysis. You can also ask [PostHog AI](/docs/posthog-ai.md) to answer questions, create insights, and build dashboards for you. ![PostHog AI example prompts](https://res.cloudinary.com/dmukukwp6/image/upload/q_auto,f_auto/SCR_20260428_byls_6beef62442.png) Try these prompts: - [`Create an insight showing daily active users for the past week`](https://app.posthog.com/#panel=max:!Create%20an%20insight%20showing%20daily%20active%20users%20for%20the%20past%20week) - [`Build a dashboard for onboarding retention`](https://app.posthog.com/#panel=max:!Build%20a%20dashboard%20for%20onboarding%20retention) - [`What changed across my product this week?`](https://app.posthog.com/#panel=max:!What%20changed%20across%20my%20product%20this%20week?) [Explore AI features](/docs/product-analytics/surfaces/mcp.md) ## Integrate your tech stack ### Session Replay Click any data point in your funnels, retention charts, or user paths and land directly in a playlist of session recordings for the users behind that number. [Session Replay](/docs/session-replay.md) runs on the same events you've already captured. ### Feature Flags Roll out or revert code updates with [Feature Flags](/docs/feature-flags.md) using product events as release conditions. ![Feature flags taregting error cohorts](https://res.cloudinary.com/dmukukwp6/image/upload/SCR_20250728_sirw_4622f2f7d0.png) ### Data Warehouse Use the [Data Warehouse](/docs/data-warehouse.md) as a single source of truth for your customer data. Sync your product data with external sources like Stripe, HubSpot, Zendesk, and more. ![Selecting a data warehouse table in a trend](https://res.cloudinary.com/dmukukwp6/image/upload/trend_light_9b29b1c254.png) ## Use for free PostHog's Product Analytics is built to be cost-effective by default, with a generous free tier and transparent usage-based pricing. Since we don't charge per seat, more than 90% of companies use PostHog for free. ## TL;DR 💸 - No credit card required to start - First 1 million events per month are free - Above 1 million we have usage-based pricing at $0.000015/event with discounts - Set billing limits to avoid surprise charges - See our [pricing page](/docs/product-analytics/pricing.md) for more up-to-date details And if that's *still* not enough, we wrote a whole page on how to [cut costs](/docs/product-analytics/cutting-costs.md). --- That's it! You're ready to start integrating. [Install Product Analytics](/docs/product-analytics/installation.md) 1/6 [**Capture your first event** ***Required***](#quest-item-capture-your-first-event)[**Create insights and dashboards** ***Required***](#quest-item-create-insights-and-dashboards)[**Identify users and groups** ***Recommended***](#quest-item-identify-users-and-groups)[**Anaylze data with MCP and AI** ***Recommended***](#quest-item-anaylze-data-with-mcp-and-ai)[**Integrate your tech stack** ***Recommended***](#quest-item-integrate-your-tech-stack)[**Use for free** ***Free 1 million events/mo***](#quest-item-use-for-free) **Capture your first event** ***Required*** ### Still have questions? Ask PostHog AI ### Was this page useful? HelpfulCould be better