diff --git a/static/js/lib/util.ts b/static/js/lib/util.ts index ea96bbe82..8150c3554 100644 --- a/static/js/lib/util.ts +++ b/static/js/lib/util.ts @@ -22,7 +22,10 @@ if (SETTINGS.posthog_api_host && SETTINGS.posthog_project_api_key) { }, }) // @ts-expect-error: SETTINGS.user is intentionally untyped - posthog.identify(SETTINGS.user.email) + if (SETTINGS.user) { + // @ts-expect-error: SETTINGS.user is intentionally untyped + posthog.identify(SETTINGS.user.email) + } } export const isErrorStatusCode = (statusCode: number): boolean =>