mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-11-18 07:22:06 +00:00
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
34 lines
893 B
TypeScript
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;
|
|
}
|