From a1619cc8b428bd17189cd451353fd43580b47979 Mon Sep 17 00:00:00 2001 From: Robbie Coomber Date: Tue, 2 Apr 2024 13:47:26 +0100 Subject: [PATCH] Add __posthog_debug query string --- src/posthog-core.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/posthog-core.ts b/src/posthog-core.ts index 357fdca1a..6efb90719 100644 --- a/src/posthog-core.ts +++ b/src/posthog-core.ts @@ -10,7 +10,7 @@ import { isCrossDomainCookie, isDistinctIdStringLike, } from './utils' -import { window, assignableWindow } from './utils/globals' +import { window, assignableWindow, location } from './utils/globals' import { autocapture } from './autocapture' import { PostHogFeatureFlags } from './posthog-featureflags' import { PostHogPersistence } from './posthog-persistence' @@ -124,7 +124,7 @@ export const defaultConfig = (): PostHogConfig => ({ save_referrer: true, capture_pageview: true, capture_pageleave: true, // We'll only capture pageleave events if capture_pageview is also true - debug: false, + debug: (location?.search && location.search.indexOf('__posthog_debug=true') !== -1) || false, verbose: false, cookie_expiration: 365, upgrade: false,