diff --git a/client/src/telemetry/glean-context.tsx b/client/src/telemetry/glean-context.tsx index eadb56ff8a17..7271da949f25 100644 --- a/client/src/telemetry/glean-context.tsx +++ b/client/src/telemetry/glean-context.tsx @@ -52,12 +52,11 @@ export type PageEventProps = { export type ElementClickedProps = { source: string; - subscriptionType: string; }; export type GleanAnalytics = { - page: (arg: PageProps) => () => void; - click: (arg: ElementClickedProps) => void; + page: (page: PageProps) => () => void; + click: (page: PageProps, element: ElementClickedProps) => void; }; const FIRST_PARTY_DATA_OPT_OUT_COOKIE_NAME = "moz-1st-party-data-opt-out"; @@ -79,7 +78,7 @@ function glean(): GleanAnalytics { //SSR return noop. return { page: (page: PageProps) => () => {}, - click: (element: ElementClickedProps) => {}, + click: (page: PageProps, element: ElementClickedProps) => {}, }; } const userIsOptedOut = document.cookie @@ -137,11 +136,11 @@ function glean(): GleanAnalytics { setPageProps(page); return () => pings.page.submit(); }, - click: (event: ElementClickedProps) => { - const { source, subscriptionType: subscription_type } = event; + click: (page: PageProps, event: ElementClickedProps) => { + setPageProps(page); + const { source } = event; elementMetric.clicked.record({ source, - subscription_type, }); pings.action.submit(); }, @@ -262,12 +261,11 @@ export function useGleanClick() { console.log({ gleanClick: source }); } - glean.click({ + glean.click(getPageProps(userData), { source, - subscriptionType: userData?.subscriptionType || "none", }); }, - [glean, userData?.subscriptionType] + [glean, userData] ); }