Skip to content

Commit

Permalink
Merge pull request #2532 from IntersectMBO/hotfix/fix-wrong-condition…
Browse files Browse the repository at this point in the history
…-on-matomo-init

hotfix: depend on network on matomo init
  • Loading branch information
MSzalowski authored Dec 16, 2024
2 parents 7cba4c5 + 3943d22 commit 09ac311
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions govtool/frontend/src/hooks/useMatomo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { useEffect } from "react";

export const useMatomo = () => {
useEffect(() => {
const env = import.meta.env.VITE_APP_ENV;
if (env !== "production" || 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 || []);
Expand All @@ -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];
Expand Down

0 comments on commit 09ac311

Please sign in to comment.