From a3be882d7314bab78a43052550c8e793641435e5 Mon Sep 17 00:00:00 2001 From: Claas Augner Date: Thu, 12 Sep 2024 15:05:26 +0200 Subject: [PATCH] fix(language-menu): measure locale-redirct clicks --- client/src/telemetry/constants.ts | 1 + .../src/ui/organisms/article-actions/language-menu/index.tsx | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/telemetry/constants.ts b/client/src/telemetry/constants.ts index 18042dcd2cd4..afef3515a706 100644 --- a/client/src/telemetry/constants.ts +++ b/client/src/telemetry/constants.ts @@ -82,5 +82,6 @@ export const BASELINE = Object.freeze({ export const CLIENT_SIDE_NAVIGATION = "client_side_nav"; export const LANGUAGE = "language"; +export const LANGUAGE_REDIRECT = "language_redirect"; export const THEME_SWITCHER = "theme_switcher"; export const SURVEY = "survey"; diff --git a/client/src/ui/organisms/article-actions/language-menu/index.tsx b/client/src/ui/organisms/article-actions/language-menu/index.tsx index 30a3d690a163..e4fec10d9cf8 100644 --- a/client/src/ui/organisms/article-actions/language-menu/index.tsx +++ b/client/src/ui/organisms/article-actions/language-menu/index.tsx @@ -9,7 +9,7 @@ import { Submenu } from "../../../molecules/submenu"; import "./index.scss"; import { DropdownMenu, DropdownMenuWrapper } from "../../../molecules/dropdown"; import { useLocale } from "../../../../hooks"; -import { LANGUAGE } from "../../../../telemetry/constants"; +import { LANGUAGE, LANGUAGE_REDIRECT } from "../../../../telemetry/constants"; import { deleteCookie, getCookieValue, @@ -129,6 +129,7 @@ function LanguageMenuItem({ function LocaleRedirectSetting() { const TRUE_VALUE = "true"; + const gleanClick = useGleanClick(); const locale = useLocale(); const [value, setValue] = useState(false); @@ -151,6 +152,7 @@ function LocaleRedirectSetting() { deleteCookie(REDIRECT_LOCALE_COOKIE_NAME); } setValue(event.target.checked); + gleanClick(`${LANGUAGE_REDIRECT}: ${locale} -> ${Number(newValue)}`); } return (