From 151d9fcb3d84d67914a0e8530fc94a675a4a3fd2 Mon Sep 17 00:00:00 2001 From: Owen Date: Thu, 6 Nov 2025 13:18:29 +0100 Subject: [PATCH] add Matomo analytics wihtout cookies --- .env.development | 2 ++ .env.production | 2 ++ package.json | 1 + src/app/[locale]/layout.tsx | 13 ++++++------- src/components/MatomoAnalytics.tsx | 30 ++++++++++++++++++++++++++++++ yarn.lock | 5 +++++ 6 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 src/components/MatomoAnalytics.tsx diff --git a/.env.development b/.env.development index 2d5dec9..0d90ae3 100644 --- a/.env.development +++ b/.env.development @@ -1 +1,3 @@ NEXT_PUBLIC_URL=http://localhost:3000 +NEXT_PUBLIC_MATOMO_URL= +NEXT_PUBLIC_MATOMO_SITE_ID= diff --git a/.env.production b/.env.production index 1116083..aa24865 100644 --- a/.env.production +++ b/.env.production @@ -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 diff --git a/package.json b/package.json index 6dce232..96a9697 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/app/[locale]/layout.tsx b/src/app/[locale]/layout.tsx index b6d554f..89e27be 100644 --- a/src/app/[locale]/layout.tsx +++ b/src/app/[locale]/layout.tsx @@ -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({ + Échecs France @@ -76,14 +77,12 @@ export default async function RootLayout({ {children} -