From 591ed134b2c01412acc3738273ff8742cd20ee82 Mon Sep 17 00:00:00 2001 From: Florent Tapponnier Date: Thu, 25 Jun 2026 14:47:31 +0200 Subject: [PATCH] feat(analytics): wire Ahrefs Web Analytics via NEXT_PUBLIC_AHREFS_KEY Privacy-friendly analytics (no cookies, no PII). Loaded async so it never blocks paint. Key is exposed as NEXT_PUBLIC_AHREFS_KEY (public by design, identifies the property not an account secret). Skipped entirely when the env var is unset so staging and preview deploys do not pollute the prod analytics graph. --- src/app/layout.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 28108fb1..be7690e2 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -182,6 +182,20 @@ export default async function RootLayout({ // biome-ignore lint/security/noDangerouslySetInnerHtml: serialized via safeJsonLd dangerouslySetInnerHTML={{ __html: safeJsonLd(ORG_JSONLD) }} /> + {/* Ahrefs Web Analytics. Privacy-friendly (no cookies, no PII), + loaded async so it never blocks paint. Key is exposed at + NEXT_PUBLIC_AHREFS_KEY so it ships with the static bundle + (the key is public by design — it identifies the property, + not an account secret). Skipped entirely when env unset so + staging/preview deploys do not pollute the analytics graph. */} + {process.env.NEXT_PUBLIC_AHREFS_KEY && ( + // eslint-disable-next-line @next/next/no-sync-scripts +