Skip to content

Commit 09ac311

Browse files
authored
Merge pull request #2532 from IntersectMBO/hotfix/fix-wrong-condition-on-matomo-init
hotfix: depend on network on matomo init
2 parents 7cba4c5 + 3943d22 commit 09ac311

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

govtool/frontend/src/hooks/useMatomo.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import { useEffect } from "react";
77

88
export const useMatomo = () => {
99
useEffect(() => {
10-
const env = import.meta.env.VITE_APP_ENV;
11-
if (env !== "production" || env !== "staging") {
12-
return;
13-
}
10+
const isSancho = window.location.href.includes("sancho");
11+
if (isSancho) return;
12+
13+
const network = import.meta.env.VITE_NETWORK_FLAG;
1414
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
1515
// @ts-expect-error
1616
const _paq = (window._paq = window._pag || []);
@@ -19,7 +19,7 @@ export const useMatomo = () => {
1919
(function () {
2020
const u = "//analytics.gov.tools/";
2121
_paq.push(["setTrackerUrl", u + "matomo.php"]);
22-
_paq.push(["setSiteId", env === "production" ? "1" : "2"]);
22+
_paq.push(["setSiteId", network === 1 ? "1" : "2"]);
2323
const d = document;
2424
const g = d.createElement("script");
2525
const s = d.getElementsByTagName("script")[0];

0 commit comments

Comments
 (0)