Files
echecsfrance/src/components/MatomoAnalytics.tsx
T
owenrees feadb465eb upgrade Nodemailer to v10
fix dead code with knip

upgrade TS to v6 and fix linting errors

auto apply oxfmt rules

fix linting errors - unused deps etc

ignore file

remove all ignored files in knip

add knip - dead code analysis tool

swap prettier and eslint of oxfmt and oxlint

fix: fix map rendering in react strict mode

fix: headlessUI float replace

fix: disable Matomo if not URL and SITE ID exist

upgrade: 1st pass upgrade to Next.js v16

deps: upgrade react to v19
2026-10-05 16:15:25 +02:00

34 lines
893 B
TypeScript

"use client";
import { useEffect } from "react";
import { trackAppRouter } from "@socialgouv/matomo-next";
import { usePathname, useSearchParams } from "next/navigation";
const MATOMO_URL = process.env.NEXT_PUBLIC_MATOMO_URL;
const MATOMO_SITE_ID = process.env.NEXT_PUBLIC_MATOMO_SITE_ID;
const isMatomoEnabled = Boolean(MATOMO_URL && MATOMO_SITE_ID);
export function MatomoAnalytics() {
const pathname = usePathname();
const searchParams = useSearchParams();
useEffect(() => {
if (!isMatomoEnabled) return;
trackAppRouter({
url: MATOMO_URL as string,
siteId: MATOMO_SITE_ID as string,
pathname,
searchParams,
enableHeatmapSessionRecording: false,
enableHeartBeatTimer: true,
cleanUrl: true,
disableCookies: true,
debug: process.env.NODE_ENV === "development",
});
}, [pathname, searchParams]);
return null;
}