From c4fc73b36fc2408b80b51a2b5f8a2a53a562185b Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 11 Sep 2026 13:55:40 +0000 Subject: [PATCH] feat: load Ahrefs Website Analytics when the env key is set Companion to GRO-38: inject the native Ahrefs tracker via next/script (afterInteractive) in the root layout, next to Google Analytics, and only when NEXT_PUBLIC_AHREFS_ANALYTICS_KEY is present. Co-authored-by: Emiliano Potignano --- example.env | 3 +++ src/app/layout.tsx | 2 ++ src/components/ahrefs-analytics.tsx | 17 +++++++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 src/components/ahrefs-analytics.tsx diff --git a/example.env b/example.env index 9b6b954..642393d 100644 --- a/example.env +++ b/example.env @@ -14,6 +14,9 @@ XAI_API_KEY=xai- NEXT_PUBLIC_POSTHOG_KEY=phc_ NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com +# Ahrefs Website Analytics +NEXT_PUBLIC_AHREFS_ANALYTICS_KEY= + # Notion NOTION_API_KEY=ntn_ NOTION_DATABASE_ID= diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 0e64e7d..a0e623e 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,3 +1,4 @@ +import { AhrefsAnalytics } from "@/components/ahrefs-analytics"; import { Footer } from "@/components/footer"; import { Header } from "@/components/header"; import { QueryClientWrapper } from "@/components/query-client-wrapper"; @@ -40,6 +41,7 @@ export default async function RootLayout({ return ( + + ); +}