diff --git a/govtool/frontend/src/hooks/useMatomo.ts b/govtool/frontend/src/hooks/useMatomo.ts index 381de7105..5c323e78c 100644 --- a/govtool/frontend/src/hooks/useMatomo.ts +++ b/govtool/frontend/src/hooks/useMatomo.ts @@ -7,10 +7,10 @@ import { useEffect } from "react"; export const useMatomo = () => { useEffect(() => { - const env = import.meta.env.VITE_APP_ENV; - if (env !== "prodction" || env !== "staging") { - return; - } + const isSancho = window.location.href.includes("sancho"); + if (isSancho) return; + + const network = import.meta.env.VITE_NETWORK_FLAG; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error const _paq = (window._paq = window._pag || []); @@ -19,7 +19,7 @@ export const useMatomo = () => { (function () { const u = "//analytics.gov.tools/"; _paq.push(["setTrackerUrl", u + "matomo.php"]); - _paq.push(["setSiteId", env === "production" ? "1" : "2"]); + _paq.push(["setSiteId", network === 1 ? "1" : "2"]); const d = document; const g = d.createElement("script"); const s = d.getElementsByTagName("script")[0];