diff --git a/assets/src/app.tsx b/assets/src/app.tsx index 62cd21653..a4cc4d515 100644 --- a/assets/src/app.tsx +++ b/assets/src/app.tsx @@ -20,6 +20,7 @@ import AppStateWrapper from "./components/appStateWrapper" import { tagManagerIdentify } from "./helpers/googleTagManager" import { fullStoryInit } from "./helpers/fullStory" import inTestGroup, { TestGroups } from "./userInTestGroup" +import { userUuid } from "./util/userUuid" document.documentElement.dataset.demoMode = inTestGroup( TestGroups.DemoMode @@ -37,11 +38,7 @@ sentryInit( window.sentryInitialization?.orgSlug ) -const userUuid = document - .querySelector("meta[name=user-uuid]") - ?.getAttribute("content") - -tagManagerIdentify(userUuid) +tagManagerIdentify(userUuid()) // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const root = createRoot(document.getElementById("app")!) diff --git a/assets/src/util/userUuid.ts b/assets/src/util/userUuid.ts new file mode 100644 index 000000000..fd14e07af --- /dev/null +++ b/assets/src/util/userUuid.ts @@ -0,0 +1,2 @@ +export const userUuid = (): string | null | undefined => + document.querySelector("meta[name=user-uuid]")?.getAttribute("content")