From 4ce09167d6f29d62ee244b0a0209e2851edc7117 Mon Sep 17 00:00:00 2001 From: Robbie Date: Wed, 3 Apr 2024 11:38:47 +0100 Subject: [PATCH] Add more defensiveness --- src/posthog-core.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/posthog-core.ts b/src/posthog-core.ts index 6efb90719..d289efcd8 100644 --- a/src/posthog-core.ts +++ b/src/posthog-core.ts @@ -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: (location?.search && location.search.indexOf('__posthog_debug=true') !== -1) || false, + debug: (location && _isString(location?.search) && location.search.indexOf('__posthog_debug=true') !== -1) || false, verbose: false, cookie_expiration: 365, upgrade: false,