PostHog JS
A strong pick. 1st of 9 product analytics SDKs.
posthog-js is the browser SDK for PostHog, an open-source analytics platform that you can self-host. One script gives you autocapture, custom events, session replay, feature flags, experiments and surveys. Today it is the strongest all-round pick in this category for teams willing to use PostHog's backend. Its supply-chain record carries a real scar from November 2025.
Best for: Engineering-led teams that want product analytics, session replay and feature flags from one open-source SDK and service.
Scores
Overall8.2
How strongly do we recommend it for a new project today?
Claude Opus 5.5: 8.0, likely 7.0 to 9.0
It is the most capable and fastest-growing SDK here, and it is backed by an open-source, well-funded platform. That makes it a strong pick for most new web products that want analytics. Pin versions, given the 2025 supply-chain incident and the daily releases. Pick Plausible or Vercel Analytics if you only need lightweight page analytics.
- npm downloadsLast4Weeks: Category leader and growing quickly
- github commitsLastYear: Very active maintenance
- theregister.com/2025/11/28/posthog_shaihulud: Recent supply-chain incident
GPT-6.2 Sol: 8.3, likely 7.3 to 9.1
PostHog JS is a strong first choice for new web products that want event tracking, replay, and flags in one integration. Plausible is a better fit for teams that mainly need lightweight traffic analytics, and buyer feedback puts PostHog alongside Amplitude and Mixpanel for full product analytics. The browser SDK migration and the recent npm compromise keep it short of a clear default across the category.
- posthog.com/docs/libraries/js/reference: Documents the integrated browser event, replay, and feature flag APIs.
- alium.io/research/what-engineers-want-from-product-analytics: Buyer feedback supports PostHog's fit for engineering teams and rates close peers similarly.
- datasaas.co/blog/analytics-script-benchmark: Shows the browser cost advantage of a focused tracker such as Plausible.
- github.com/PostHog/posthog-js/issues/5652: Documents remaining migration work for the successor package.
- posthog.com/blog/nov-24-shai-hulud-attack-post-mortem: Records the npm supply-chain compromise and the subsequent publishing changes.
Needed by many6.8
How many developers need a tool for this job?
Claude Opus 5.5: 7.0, likely 6.0 to 8.0
Most teams building web apps or SaaS products want product analytics. PostHog's all-in-one take, with replay and flags, fits a large share of them. The package covers the browser only, while Node and React Native use separate packages, so it is a little narrower than the category.
- github description: Web app and site SDK with autocapture
- startupik.com/posthog-vs-mixpanel-vs-amplitude-which-product-analytics-tool-wins/?amp=1: Positioned for startups that want analytics, replay, flags and experiments in one stack
GPT-6.2 Sol: 6.6, likely 5.5 to 7.6
Product event tracking serves a large group of JavaScript and TypeScript teams building user-facing web apps. The SDK works across major frontend frameworks and plain JavaScript, while server-side tracking uses a separate SDK. Developer surveys establish how common browser development is, but leave the share of projects that need full product analytics uncertain.
- 2025.stateofjs.com/en-US/other-tools/#runtimes: Browsers rank among the most used JavaScript runtimes.
- supabase.com/state-of-startups: Startup respondents report vendor tools, custom dashboards, and foregoing tracking.
- posthog.com/docs/libraries/js: Supports plain JavaScript and several major frontend frameworks.
- posthog.com/docs/libraries/js/reference: Browser SDK reference directs server-side users to a separate SDK.
Helps a lot8.4
How well does it do the job for those who need it?
Claude Opus 5.5: 8.0, likely 7.0 to 9.0
No peer SDK has a wider feature set. It has autocapture, replay, flags, experiments and surveys, plus typed APIs and strong docs. Users praise session replay and flag propagation. The limits are bundle weight, a reported replay memory leak, and the complexity that comes with so many features.
- g2.com/products/posthog/reviews: Users praise replay and flags; one reports a replay memory leak
- rollbar.com/blog/session-replay-scripts-performance: Independent test puts the PostHog bundle at about 52 KB with lazy loading
- posthog.com/docs/libraries/js.md: Documents a slim bundle and extension bundles
- npm hasTypes: Ships TypeScript types
GPT-6.2 Sol: 8.7, likely 7.7 to 9.5
Stable version 1.453.2 combines autocapture, explicit events, identity, replay, and flags in one client. Its types, setup examples, and debug mode give developers and coding agents a clear path for basic instrumentation, while consent and route tracking still depend on configuration. An independent page-load test found the standard script substantially heavier than Plausible, and a user confirmed that an SDK update fixed a replay slowdown in their app. Performance varies by bundle and feature set, and the available measurements cover specific setups.
- github.com/PostHog/posthog-js/releases/tag/posthog-js@1.453.2: Confirms the stable browser release being scored.
- npm.hasTypes: Ships TypeScript declarations.
- posthog.com/docs/libraries/js/reference: Documents capture, identity, privacy settings, route tracking, and debug mode.
- datasaas.co/blog/analytics-script-benchmark: Measured a heavier default script than Plausible on the same test page.
- github.com/PostHog/posthog-js/issues/3273: A user reported replay blocking the main thread and confirmed recovery after upgrading.
Holds up over time8.1
Will it still be a good choice in two years?
Claude Opus 5.5: 8.5, likely 7.5 to 9.5
Activity is very high: 2,935 commits, 3,674 merged PRs in total, 251 contributors, and a push on the day we read the data. A company raised a $75M Series E in 2025 and pays for the work. The very fast release cadence is the main risk, because it raises the chance of regressions.
- github commitsLastYear: 2,935 commits in the last year
- npm versionsLastYear: 569 versions in a year
- builtin.com/articles/posthog-raises-70m-series-d-20250616: Series D led by Stripe at a $920M valuation
- sacra.com/research/58m-year-hedgehog-of-product-analytics: Revenue growing quickly
GPT-6.2 Sol: 7.7, likely 6.5 to 8.8
PostHog staffs a dedicated SDK team with rotating support, and the browser package shipped 569 versions in the past year. The repository-wide commit and release totals also include other SDKs and tools. Dated configuration defaults let teams adopt behavior changes on their own schedule. PostHog is preparing @posthog/browser v2 and tracking migration gaps, which leaves the current package's two-year support outlook uncertain.
- npm.versionsLastYear: 569 publications for the browser package itself.
- github: Shared repository totals include releases for packages such as @posthog/mcp.
- posthog.com/teams/client-libraries: Staffed SDK team with rotating support and a browser v2 release goal.
- posthog.com/docs/libraries/js/reference: Dated defaults preserve earlier behavior until teams opt in.
- github.com/PostHog/posthog-js/issues/5652: Tracks API differences and remaining work for migration to @posthog/browser.
Used widely7.6
How many use it, and is that growing?
Claude Opus 5.5: 8.0, likely 7.0 to 9.0
It has about 101M downloads in 4 weeks, up 12x on a year before, which is well above the 4.1 median ratio. That is the most in the category. Part of that is probably CI installs and other tools that pull it in. Its 2,707 dependent repos lead every peer except Vercel Analytics (18,078), which supports real and growing direct use.
- npm downloadsLast4Weeks: 101M, against 8.4M a year ago
- medianDownloadsRatio: 12x growth against a 4.1 median
- dependents repos: 2,707, second to Vercel Analytics
GPT-6.2 Sol: 7.2, likely 6.1 to 8.3
Four-week npm downloads rose from 8.35 million to 101.25 million, or 12.1×, well above the catalog's 4.1× baseline. Ecosyste.ms found 2,707 dependent repositories, more than Mixpanel, Amplitude, or Segment in this sample and far fewer than Vercel Analytics. FirstSited detected PostHog on about 80,000 sites at launch since April, and Ramp reports rising adoption among buyers in its category. Automated installs and React wrappers inflate npm counts, while script-tag installs bypass npm, so the direct project count remains an estimate.
- npm.downloadsLast4Weeks, npm.downloadsSame4WeeksYearAgo, medianDownloadsRatio: 101.25 million versus 8.35 million downloads, or 12.1× against a 4.1× baseline.
- dependents, peers: 2,707 indexed repositories and 92 packages. Vercel Analytics leads indexed repositories with 18,078.
- github.com/PostHog/posthog-js/blob/posthog-js@1.453.2/packages/react/package.json: The first-party React wrapper declares posthog-js as a peer dependency.
- posthog.com/docs/libraries/js: Supports script-tag installation without an npm dependency.
- firstsited.com/tech/posthog: Detected about 80,000 launches using PostHog, with recent share flat month over month.
- ramp.com/vendors/posthog: Adoption in Ramp's category sample rose 17 percentage points year over year.
Vouched for7.3
Who stands behind it being good?
Claude Opus 5.5: 7.0, likely 6.0 to 8.0
More than 1,000 G2 reviews average about 4.5, and many startups run it in production. Even its rival Amplitude describes it as the engineer-focused all-in-one choice. Stripe led a funding round. There is no independent survey data for this category, and many comparisons are written by vendors, which keeps the score below 8.
- g2.com/products/posthog/reviews: About 1,050 reviews, rated about 4.5
- amplitude.com/compare/posthog-vs-mixpanel: A rival describes PostHog as the open-source all-in-one tool for engineers
- hackerNews stories: 87 stories; strong developer attention
GPT-6.2 Sol: 7.6, likely 6.5 to 8.7
Langfuse lists the browser SDK in its web app, and Linear names PostHog as a product analytics provider. Alium's buyer interviews describe engineering teams using the combined analytics and replay workflow and rate the platform roughly alongside Amplitude and Mixpanel. That feedback is mostly about the platform, so there is less direct evidence about long-term satisfaction with this browser package.
- github.com/langfuse/langfuse/blob/main/web/package.json: Langfuse's web app directly declares posthog-js.
- linear.app/dpa: Linear lists PostHog as a product analytics subprocessor.
- alium.io/research/what-engineers-want-from-product-analytics: Verified buyer interviews give PostHog roughly the same platform rating as Amplitude and Mixpanel.
Safe6.4
How safe is it to depend on?
Claude Opus 5.5: 6.0, likely 4.5 to 7.5
Version 1.297.3 shipped the Shai-Hulud 2.0 credential-stealing worm in November 2025, through a CI workflow flaw. PostHog pulled it within hours and published a post-mortem. It moved to npm trusted publishing and disabled install scripts in CI. The Scorecard is 7.9, with weak branch protection and a weak security policy. The licence is permissive and there are 10 dependencies, but the incident is recent and serious.
- advisories MAL-2025-191402: Malicious version published November 2025
- theregister.com/2025/11/28/posthog_shaihulud: Root cause was a CI workflow flaw; PostHog moved to trusted publishing
- posthog.com/blog/nov-24-shai-hulud-attack-post-mortem.md: Post-mortem lists the affected versions and the fixes
- scorecard score: 7.9; Branch-Protection 4, Security-Policy 4
- npm license: Apache-2.0 AND MIT
GPT-6.2 Sol: 6.7, likely 5.5 to 7.9
The November 2025 compromise affected npm version 1.297.3, which PostHog removed within about five hours of publication before moving to trusted publishing and requiring security review for workflow changes. The older cross-site scripting issue was patched in 1.57.2. The package uses permissive Apache-2.0 AND MIT terms, and the current SDK can verify runtime extensions or use a build that avoids loading them. Ten direct dependencies, optional runtime scripts, and weak branch protection and security policy checks on a 7.9 OpenSSF Scorecard keep the range wide.
- osv.dev/vulnerability/MAL-2025-191402: Identifies 1.297.3 as the compromised browser package release.
- posthog.com/blog/nov-24-shai-hulud-attack-post-mortem: Documents rapid removal, credential revocation, and changes to publishing controls.
- github.com/advisories/GHSA-8775-5hwv-wr6v: The moderate cross-site scripting issue was patched in 1.57.2.
- npm.license, npm.dependencies: Apache-2.0 AND MIT with ten direct dependencies.
- scorecard: 7.9 overall, with branch protection and security policy at 4 out of 10.
- posthog.com/docs/libraries/js/security: Documents opt-in script integrity and a bundle without external executable code.
Good
- One SDK covers analytics, autocapture, session replay, feature flags, experiments, surveys and heatmaps.
- Very active development: about 2,900 commits a year, 251 contributors and a well-funded company behind it.
- Ships TypeScript types and has thorough docs, a slim bundle and lazy-loaded extensions to cut its weight.
- The PostHog backend is open source and can be self-hosted, unlike the Mixpanel, Amplitude and Segment services.
Bad
- Version 1.297.3 was published with the Shai-Hulud 2.0 worm in November 2025, after a CI workflow flaw.
- The full bundle is heavy (roughly 50 KB or more) next to tiny trackers like Plausible or Vercel Analytics.
- Releases ship several times a day (569 versions a year), so behaviour changes such as consent defaults can slip in unnoticed.
- Ties you to PostHog's backend, unlike vendor-neutral layers such as Analytics or RudderStack.
The numbers
- npm downloads, 4 weeks
- 101M ×12 in a year
- GitHub stars
- 649
- Commits, 12 months
- 2.9k
- npm version
- 1.453.2 Nov 2026
- Versions, 12 months
- 569
- Advisories, 24 months
- 1 of 2 ever
- OpenSSF Scorecard
- 7.9 out of 10, Nov 2026
- Licence
- (Apache-2.0 AND MIT)
Read on 21 November 2026 from GitHub (PostHog/posthog-js), npm (posthog-js), OSV and the OpenSSF Scorecard.
Product analytics SDKs
- 8.2PostHog JS
- 7.3Amplitude SDK
- 7.3Plausible tracker
- 7.0Mixpanel SDK
- 6.8RudderStack SDK
- 6.5OpenPanel
- 6.5Segment Analytics.js
- 6.2Vercel Analytics
- 4.9Analytics