:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(csp): opt the placeholder posthog-js instance out from init (#105501)
Tom Piccirello2226caf1de0a
diff --git a/frontend/src/loadPostHogJS.test.ts b/frontend/src/loadPostHogJS.test.tsindex 13ab6a273c2f..ea0ae502e531 100644--- a/frontend/src/loadPostHogJS.test.ts+++ b/frontend/src/loadPostHogJS.test.ts@@ -21,7 +21,7 @@ describe('loadPostHogJS', () => {expect(posthog.init).toHaveBeenCalledWith('fake_token',- expect.objectContaining({ advanced_disable_flags: true })+ expect.objectContaining({ advanced_disable_flags: true, opt_out_capturing_by_default: true }))})})diff --git a/frontend/src/loadPostHogJS.tsx b/frontend/src/loadPostHogJS.tsxindex 07dcaacd8382..4ca2b9c1d47b 100644--- a/frontend/src/loadPostHogJS.tsx+++ b/frontend/src/loadPostHogJS.tsx@@ -194,6 +194,9 @@ export function loadPostHogJS(options: LoadPostHogJSOptions = {}): void {// init() fetches remote config and flags for the placeholder token from PostHog Cloud// before `loaded` can opt out.advanced_disable_flags: true,+ // `loaded` runs at the end of init(). An event captured before then stays in the request+ // queue, and the queue sends it to PostHog Cloud on page unload even after the opt-out.+ opt_out_capturing_by_default: true,loaded: function (ph) {ph.opt_out_capturing()},