mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-07-22 20:16:57 +00:00
add Matomo analytics wihtout cookies
This commit is contained in:
@@ -1 +1,3 @@
|
||||
NEXT_PUBLIC_URL=http://localhost:3000
|
||||
NEXT_PUBLIC_MATOMO_URL=
|
||||
NEXT_PUBLIC_MATOMO_SITE_ID=
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
NEXT_PUBLIC_URL=https://$NEXT_PUBLIC_VERCEL_URL
|
||||
NEXT_PUBLIC_MATOMO_URL=https://analytics.owenrees.eu
|
||||
NEXT_PUBLIC_MATOMO_SITE_ID=2
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"@hookform/resolvers": "^3.9.0",
|
||||
"@infra-blocks/zod-utils": "^0.4.2",
|
||||
"@next/bundle-analyzer": "^14.0.4",
|
||||
"@socialgouv/matomo-next": "^1.10.0",
|
||||
"@tanstack/react-query": "^5.29.0",
|
||||
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
|
||||
"@turf/boolean-point-in-polygon": "^7.0.0-alpha.114",
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { ReactNode } from "react";
|
||||
import { ReactNode, Suspense } from "react";
|
||||
|
||||
import { NextIntlClientProvider } from "next-intl";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { Inter, Julius_Sans_One } from "next/font/google";
|
||||
import { notFound } from "next/navigation";
|
||||
import Script from "next/script";
|
||||
|
||||
import { LocaleChecker } from "@/components/LocaleChecker";
|
||||
import "@/css/globals.css";
|
||||
import Providers from "@/providers";
|
||||
|
||||
import Footer from "./(main)/components/Footer";
|
||||
import { MatomoAnalytics } from "@/components/MatomoAnalytics";
|
||||
|
||||
const inter = Inter({ subsets: ["latin"], variable: "--font-inter" });
|
||||
const title = Julius_Sans_One({
|
||||
@@ -67,6 +67,7 @@ export default async function RootLayout({
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<meta name="theme-color" content="#00A1F0" />
|
||||
<link rel="manifest" href="/manifest.webmanifest" />
|
||||
<title>Échecs France</title>
|
||||
</head>
|
||||
<body>
|
||||
<Providers>
|
||||
@@ -76,14 +77,12 @@ export default async function RootLayout({
|
||||
{children}
|
||||
</div>
|
||||
</LocaleChecker>
|
||||
|
||||
<Footer />
|
||||
</NextIntlClientProvider>
|
||||
|
||||
{/*<Script*/}
|
||||
{/* defer*/}
|
||||
{/* src="https://app.tinyanalytics.io/pixel/HyoumUokLr9exPgX"*/}
|
||||
{/*/>*/}
|
||||
<Suspense fallback={null}>
|
||||
<MatomoAnalytics />
|
||||
</Suspense>
|
||||
</Providers>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
"use client";
|
||||
|
||||
import { trackAppRouter } from "@socialgouv/matomo-next";
|
||||
import { usePathname, useSearchParams } from "next/navigation";
|
||||
import { useEffect } from "react";
|
||||
|
||||
const MATOMO_URL = process.env.NEXT_PUBLIC_MATOMO_URL;
|
||||
const MATOMO_SITE_ID = process.env.NEXT_PUBLIC_MATOMO_SITE_ID;
|
||||
|
||||
export function MatomoAnalytics() {
|
||||
const pathname = usePathname();
|
||||
const searchParams = useSearchParams();
|
||||
|
||||
useEffect(() => {
|
||||
trackAppRouter({
|
||||
url: MATOMO_URL || "",
|
||||
siteId: MATOMO_SITE_ID || "",
|
||||
pathname,
|
||||
searchParams, // Pass URLSearchParams object directly
|
||||
// Optional: Enable additional features
|
||||
enableHeatmapSessionRecording: false,
|
||||
enableHeartBeatTimer: true,
|
||||
cleanUrl: true,
|
||||
disableCookies: true,
|
||||
debug: process.env.NODE_ENV === "development",
|
||||
});
|
||||
}, [pathname, searchParams]);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -1785,6 +1785,11 @@
|
||||
resolved "https://registry.yarnpkg.com/@rushstack/eslint-patch/-/eslint-patch-1.10.4.tgz#427d5549943a9c6fce808e39ea64dbe60d4047f1"
|
||||
integrity sha512-WJgX9nzTqknM393q1QJDJmoW28kUfEnybeTfVNcNAPnIx210RXm2DiXiHzfNPJNIUUb1tJnz/l4QGtJ30PgWmA==
|
||||
|
||||
"@socialgouv/matomo-next@^1.10.0":
|
||||
version "1.10.0"
|
||||
resolved "https://registry.yarnpkg.com/@socialgouv/matomo-next/-/matomo-next-1.10.0.tgz#f3015865f767faa944eee927f8215c7d4ba283a7"
|
||||
integrity sha512-Cp4EMnpzPO2JAinW56QrT6t+AJnM7pxUS3RUmfBWs9SIxHsqxivdmb+wSS8bUd/lkUXtLgBVw9dGOaK0EMwSEg==
|
||||
|
||||
"@surma/rollup-plugin-off-main-thread@^2.2.3":
|
||||
version "2.2.3"
|
||||
resolved "https://registry.yarnpkg.com/@surma/rollup-plugin-off-main-thread/-/rollup-plugin-off-main-thread-2.2.3.tgz#ee34985952ca21558ab0d952f00298ad2190c053"
|
||||
|
||||
Reference in New Issue
Block a user