diff --git a/client/src/document/index.tsx b/client/src/document/index.tsx index 52ab4700bb75..c2d85be76075 100644 --- a/client/src/document/index.tsx +++ b/client/src/document/index.tsx @@ -3,7 +3,6 @@ import { useNavigate } from "react-router-dom"; import useSWR, { mutate } from "swr"; import { WRITER_MODE, PLACEMENT_ENABLED } from "../env"; -import { useGA } from "../ga-context"; import { useIsServer, useLocale } from "../hooks"; import { useDocumentURL, useDecorateCodeExamples, useRunSample } from "./hooks"; @@ -62,7 +61,6 @@ export class HTTPError extends Error { } export function Document(props /* TODO: define a TS interface for this */) { - const { gtag } = useGA(); const gleanClick = useGleanClick(); const isServer = useIsServer(); @@ -137,14 +135,6 @@ export function Document(props /* TODO: define a TS interface for this */) { if (doc && !error) { if (mountCounter.current > 0) { const location = window.location.toString(); - // 'dimension19' means it's a client-side navigation. - // I.e. not the initial load but the location has now changed. - // Note that in local development, where you use `localhost:3000` - // this will always be true because it's always client-side navigation. - gtag("event", "pageview", { - dimension19: "Yes", - page_location: location, - }); gleanClick(`${CLIENT_SIDE_NAVIGATION}: ${location}`); } @@ -152,7 +142,7 @@ export function Document(props /* TODO: define a TS interface for this */) { // a client-side navigation happened. mountCounter.current++; } - }, [gtag, gleanClick, doc, error]); + }, [gleanClick, doc, error]); React.useEffect(() => { const location = document.location; diff --git a/client/src/site-search/index.tsx b/client/src/site-search/index.tsx index 0d3c15b6da9c..c406324e6bdc 100644 --- a/client/src/site-search/index.tsx +++ b/client/src/site-search/index.tsx @@ -3,7 +3,6 @@ import { useSearchParams } from "react-router-dom"; import { useIsServer } from "../hooks"; import { Loading } from "../ui/atoms/loading"; import { MainContentContainer } from "../ui/atoms/page-content"; -import { useGA } from "../ga-context"; import { useGleanClick } from "../telemetry/glean-context"; import "./index.scss"; import { SidePlacement } from "../ui/organisms/placement"; @@ -14,7 +13,6 @@ const SearchResults = React.lazy(() => import("./search-results")); export function SiteSearch() { const isServer = useIsServer(); - const { gtag } = useGA(); const gleanClick = useGleanClick(); const [searchParams] = useSearchParams(); @@ -34,24 +32,14 @@ export function SiteSearch() { const mountCounter = React.useRef(0); React.useEffect(() => { - if (gtag) { - if (mountCounter.current > 0) { - const location = window.location.toString(); - // 'dimension19' means it's a client-side navigation. - // I.e. not the initial load but the location has now changed. - // Note that in local development, where you use `localhost:3000` - // this will always be true because it's always client-side navigation. - gtag("event", "pageview", { - dimension19: "Yes", - page_location: location, - }); - gleanClick(`${CLIENT_SIDE_NAVIGATION}: ${location}`); - } - // By counting every time a document is mounted, we can use this to know if - // a client-side navigation happened. - mountCounter.current++; + if (mountCounter.current > 0) { + const location = window.location.toString(); + gleanClick(`${CLIENT_SIDE_NAVIGATION}: ${location}`); } - }, [query, page, gtag, gleanClick]); + // By counting every time a document is mounted, we can use this to know if + // a client-side navigation happened. + mountCounter.current++; + }, [query, page, gleanClick]); return (