diff --git a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/View.tsx b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/View.tsx index 6d30de07faf..3731ce3ed01 100644 --- a/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/View.tsx +++ b/src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/View.tsx @@ -80,7 +80,7 @@ export type TabData = { export const View = (props: Props) => { const l10n = useL10n(); - const recordTelemetry = useTelemetry(); + const recordTelemetry = useTelemetry(props.telemetryId); const countryCode = useContext(CountryCodeContext); const adjustedScanResults = props.userScanData.results.map((scanResult) => { diff --git a/src/app/components/client/PageLoadEvent.tsx b/src/app/components/client/PageLoadEvent.tsx index 81cc8e4f18e..4c66ef7b1c3 100644 --- a/src/app/components/client/PageLoadEvent.tsx +++ b/src/app/components/client/PageLoadEvent.tsx @@ -25,7 +25,7 @@ export const PageLoadEvent = (props: Props) => { ]); const pathname = usePathname(); - const recordTelemetry = useTelemetry(); + const recordTelemetry = useTelemetry(props.userId); const userId: GleanMetricMap["page"]["view"]["user_id"] = useMemo(() => { // If the user is not logged in, use randomly-generated user ID and store in cookie. diff --git a/src/app/hooks/useGlean.ts b/src/app/hooks/useGlean.ts index d464aa68482..4de33f0b5e4 100644 --- a/src/app/hooks/useGlean.ts +++ b/src/app/hooks/useGlean.ts @@ -10,7 +10,7 @@ import EventMetricType from "@mozilla/glean/private/metrics/event"; import type { GleanMetricMap } from "../../telemetry/generated/_map"; import { PublicEnvContext } from "../../contextProviders/public-env"; -export const useGlean = () => { +export const useGlean = (experimentationId?: string) => { const { PUBLIC_APP_ENV } = useContext(PublicEnvContext); // Initialize Glean only on the first render of our custom hook. @@ -42,6 +42,7 @@ export const useGlean = () => { maxEvents: 1, channel: PUBLIC_APP_ENV, enableAutoPageLoadEvents: true, + experimentationId: experimentationId, }); // This effect should only run once // eslint-disable-next-line react-hooks/exhaustive-deps diff --git a/src/app/hooks/useTelemetry.ts b/src/app/hooks/useTelemetry.ts index 0cbc136efa9..28cb014be1d 100644 --- a/src/app/hooks/useTelemetry.ts +++ b/src/app/hooks/useTelemetry.ts @@ -17,9 +17,9 @@ const TelemetryPlatforms = { Ga: "ga", } as const; -export const useTelemetry = () => { +export const useTelemetry = (experimentationId?: string) => { const path = usePathname(); - const recordGlean = useGlean(); + const recordGlean = useGlean(experimentationId); const { Glean, Ga } = TelemetryPlatforms; const recordTelemetry = <