Product Benefits Pricing Guides Docs About Contact us Try it out
Analytics tools

PostHog SDK Script Integrity (SHA-384) Tracking

PostHog browser SDK installs can pin a SHA-384 hash. Track script integrity failures so a blocked SDK never hides web analytics data.

· 3 min read

A tracking script is code that runs on every page you own. If it changes unexpectedly, you have a security problem. If it is blocked to protect you, you have a data problem. Pinning a hash solves the first and can quietly create the second, because a browser that rejects a script does not send your team an email. It just stops sending events.

On 6 November 2026, PostHog announced that browser SDK installs can pin a SHA-384 hash for the core script that the static loader downloads. If the bytes have been modified, the browser rejects them instead of loading them. The changelog does not name the option used to set the hash, so follow the PostHog libraries documentation for the exact syntax.

Why This Matters

Hash pinning is good practice, but it creates a new failure mode. When PostHog publishes a new core script and your pinned hash is out of date, every visitor on that page can lose analytics until you update it. Without monitoring, the first sign is an empty dashboard.

Data Points to Track

  • integrity_check_result (passed, failed, not supported)
  • pinned_hash_version or the SDK version the hash belongs to
  • sdk_load_success_rate, measured outside the SDK
  • events_per_page_request: captured events against server-side page requests
  • script_error_type from the browser’s error handler
  • browser_name, browser_version and in_app_browser flag
  • csp_violation_count if you use a content security policy
  • time_to_detect_minutes for each incident

Setup Steps

  1. Record your normal ratio of captured pageviews to server-side requests as a baseline.
  2. Add a lightweight error listener that reports a script load failure to a separate, minimal endpoint, since the SDK itself will not be running.
  3. Pin the SHA-384 hash in a staging environment, using the method in the PostHog documentation.
  4. Test with a deliberately wrong hash and confirm the browser blocks the script and your listener reports it.
  5. Deploy to production behind a small traffic share.
  6. Add an alert for a drop of more than 20% in the capture ratio over an hour.
  7. Add a checklist item to your upgrade process: update the pinned hash whenever you change the SDK version.

Actionable Insights

A sudden drop in the capture ratio right after a deploy usually means a stale hash. Compare it with the time of your last SDK or loader change.

A steady failure rate on one browser points to a compatibility problem, not an attack. Test the affected version and decide whether to serve a fallback.

Failures that appear on a single page suggest a different script version was hard-coded there. Search your templates for old tags.

Keep a log of every integrity failure. Even if each one turns out to be a mistake, a pattern shows where your release process leaks.

Common Mistakes to Avoid

Do not pin a hash without a way to detect failures. Do not rely on the SDK to report its own load failure. Do not forget to update tag managers and test pages that load the same script.