Sourcemap Explorer
Stack · npm package

posthog-js

Posthog-js allows you to automatically capture usage and send events to PostHog.

latest 1.413.3· (Apache-2.0 AND MIT)· 1,302 versions publishedView on npm

About

Posthog-js allows you to automatically capture usage and send events to PostHog.

What detecting posthog-js tells you about a site

posthog-js marks a product that instruments user behaviour, and usually one that leans toward the all-in-one, often self-hostable PostHog platform: product analytics, feature flags, session replay and experiments in a single SDK. Finding it tells you the team tracks events and funnels, and quite possibly runs feature flags and A/B tests from the same source. Its presence skews toward product-led and engineering-driven companies, since PostHog is popular with teams that want their analytics in-house or open-source rather than handing data to a pure third-party. It is a clear sign that product decisions here are measured, not guessed.

Why the exact posthog-js version matters

posthog-js evolves quickly, and capabilities like autocapture defaults, session replay, surveys and the feature-flag bootstrap have arrived and changed across versions. The exact version tells you which of these subsystems are even available and how aggressively the SDK captures by default, which has real privacy and data-volume implications worth knowing.

posthog-js in a real-world stack

When you find posthog-js in a bundle, it rarely travels alone. Often the only analytics SDK present, since PostHog deliberately bundles flags, replay and experiments together.

Quick facts

Latest version1.413.3
License(Apache-2.0 AND MIT)
Authorengineering@posthog.com
Installnpm install posthog-js
Direct dependencies10

What posthog-js pulls in

posthog-js declares 10 direct dependencies — each one also rides into any bundle that ships posthog-js, so they are detection targets too. Reading them is a quick way to understand the package's real footprint .

fflatepreactcore-jsdompurifyweb-vitals@posthog/core@posthog/typesweb-vitals-soft-navs@posthog/browser-commonquery-selector-shadow-dom

How Sourcemap Explorer detects posthog-js

posthog-js ships as v1.413.3, published 2026-08-06 and carries 10 direct dependencies, 1,302 versions on the registry. Those exact numbers are the footprint Sourcemap Explorer matches when posthog-js rides inside a deployed bundle — here is how the detection works.

We catch posthog-js from two complementary signals: bundled source paths and the embedded package.json. Modern bundlers (webpack, Vite, esbuild, Rollup, Turbopack) preserve the original node_modules/posthog-js/ paths inside the JavaScript sourcemap's sources[] array — that's the canonical signal. When the matching package.json is also captured in sourcesContent[], we read the exact version field — patch number included. No regex guessing, no version inference.

  1. 1

    Confirm the site exposes sourcemaps

    In DevTools Network, check the response headers of any application script for `SourceMap` or `X-SourceMap`. Failing that, fetch the script's last 4 KB and look for a `//# sourceMappingURL=` comment — that map is where the `posthog-js` paths live.

  2. 2

    Find the package in the bundle

    Open DevTools → Network → reload. Click any application script and look at its sourcemap. Inside, search `sources[]` for entries matching `node_modules/posthog-js/` — every match confirms the package is bundled. The matching `sourcesContent[i]` for `node_modules/posthog-js/package.json` gives you the exact installed version.

  3. 3

    Read the version directly from package.json

    Run `jq -r '. as $m | $m.sources | to_entries[] | select(.value | endswith("node_modules/posthog-js/package.json")) | $m.sourcesContent[.key] | fromjson | .version' bundle.js.map`. Sourcemap Explorer automates the same query in the popup.

Recent security advisories for posthog-js

The 2 most recent advisories affecting some versions of posthog-js, aggregated from OSV.dev (GitHub Advisory + CVE data). A listing here doesn't mean the version a given site ships is affected — each advisory applies to a specific version range. Sourcemap Explorer reads the exact bundled version so you can check it against these ranges.

  1. MAL-2025-191402· 2025-11-25

    Malicious code in posthog-js (npm)

  2. MODERATECVE-2023-32325· 2023-05-22

    Potential for cross-site scripting in PostHog-js

Recent versions

Version
Released
1.413.3
2026-08-06
1.413.2
2026-08-05
1.413.1
2026-08-05
1.413.0
2026-08-05
1.412.2
2026-08-05
1.412.1
2026-08-05
1.412.0
2026-08-05
1.411.0
2026-08-04

posthog-js README

Live mirror of the GitHub README, for reference. Updated whenever the repo's default branch changes.

FAQ

What is posthog-js used for?

Posthog-js allows you to automatically capture usage and send events to PostHog.

How can I tell if a website is using posthog-js?

Open the page in Chrome with the Sourcemap Explorer extension installed and read the Stack tab. We catch `posthog-js` from two complementary signals: `node_modules/posthog-js/` paths inside the JavaScript sourcemap, and the embedded `package.json` we read for exact-version detection. Without the extension you can do the same lookup manually in DevTools — the steps are listed in the "How Sourcemap Explorer detects" section above.

How do I find out which version of posthog-js a website is running?

Read it straight from the site's JavaScript sourcemap. When a build ships source maps, the bundled `posthog-js/package.json` carries the exact `version` string — Sourcemap Explorer extracts it in one click on the Stack tab, and you can do it by hand in DevTools by opening the `.map` file and searching for `node_modules/posthog-js/package.json`. That is far more reliable than inferring the version from an asset-hash or a `?ver=` query string, which is all surface-level detectors have to go on. The current npm release is 1.413.3, but real deployments frequently run an older pinned version — which is exactly why reading the bundled number matters.

What is the latest version of posthog-js?

1.413.3, as published on the npm registry. The "Recent versions" table on this page lists the most recent 8 releases with their release dates. Sourcemap Explorer reports the version actually bundled into a site, which can lag the latest release by months on real-world deployments.

Is posthog-js actively maintained?

Very actively maintained — the last release shipped within the past three months. The last published release was 2026-08-06. Source code: https://github.com/PostHog/posthog-js.

Does posthog-js have known security vulnerabilities?

2 recent advisories affecting some versions of posthog-js are listed in the "Recent security advisories" section above, aggregated from OSV.dev (GitHub Advisory + CVE data). Whether a particular site is exposed depends entirely on the exact version it ships — each advisory applies to a specific version range, not to the package as a whole. That is why the precise bundled version matters: Sourcemap Explorer reads the version a site actually runs, so you can check it against the affected ranges instead of assuming the latest release is what's deployed.

Where can I read more?

Project homepage: https://posthog.com/docs/libraries/js. Source code: https://github.com/PostHog/posthog-js. Published on npm: https://www.npmjs.com/package/posthog-js. Licensed as (Apache-2.0 AND MIT).

Detected by Sourcemap Explorer

When a bundle ships sourcemaps, we read the embedded package.json for posthog-js and report the precise version (the registry's latest is v1.413.3, published 2026-08-06; the bundled copy is often older). Without sourcemaps, an import / require in the page's scripts is enough to flag it.

Install free on Chrome