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

PostHog Browser Remote Config CSP Tracking

PostHog's browser SDK now fetches remote config as JSON. Learn what to track so a strict CSP does not silently break web analytics.

· 3 min read

A Content Security Policy (CSP) is a header that tells the browser which hosts a page may talk to. It protects your users, but it also has a habit of breaking analytics without a visible error. The page loads, nothing looks wrong, and events quietly stop arriving.

On 20 November 2026, PostHog changed how its browser SDK loads remote configuration. When site apps are off, the SDK now fetches the config as JSON instead of running generated configuration JavaScript. If you load PostHog directly under a CSP, you need to allow the assets host in connect-src.

Why This Matters

A safer loading method is good news, but it changes which requests your pages make. If your policy permits scripts but not the new connection, the SDK may start without its remote settings, such as feature flags or capture rules, and fall back to defaults.

Because the site still works, the first sign is often a drop in event volume days later, long after the change shipped.

What Goes Wrong Without It

Teams often tighten a CSP during a security review and test only that pages render. Analytics is rarely on the checklist. A policy that blocks the config request can leave you with partial data for weeks: pageviews arrive, but flag-based experiments and capture rules behave differently from what you designed. Treat analytics loading as a tested feature of every release, with an owner and an alert, rather than an assumption.

Data Points to Track

Add these to a small diagnostic event, analytics_init_health, and to your CSP reporting:

  • sdk_init_success: true or false
  • remote_config_loaded: true or false
  • remote_config_load_ms
  • remote_config_source: json, cached or default
  • csp_violation_count for the analytics hosts
  • blocked_directive: for example connect-src
  • blocked_host
  • sdk_version and page_template
  • browser_name and browser_version
  • events_captured_first_10s
  • site_apps_enabled: true or false

Setup Steps

  1. Check which PostHog hosts your pages already allow and note them in your policy file.
  2. Add the assets host to connect-src in a staging environment first.
  3. Turn on CSP reporting, using a report-to or report-uri endpoint, and collect violations for the analytics hosts.
  4. Add the analytics_init_health event after the SDK starts, recording whether remote config loaded.
  5. Update to the SDK version with the JSON config fetch.
  6. Test the main page templates in several browsers and confirm no violations appear.
  7. Alert on a fall in remote_config_loaded or a rise in violations after each deploy.

Actionable Insights

Config load rate. A healthy site loads remote config almost every time. Anything lower points to a blocked request or a slow network.

Violations by page template. Different templates often have different policies. A cluster on one template shows where the header differs.

Event volume after deploys. Compare events captured in the first ten seconds before and after each release. A sudden drop is an early warning.

Feature flag fallbacks. If remote config does not load, flags may return defaults. Check that experiments are not running on the wrong variant.

Browser differences. Some browsers report violations differently, so segment by browser before drawing conclusions.