From 1fdce54f702ac1b216e61ae4348fae8dac2be6f5 Mon Sep 17 00:00:00 2001 From: Alejandro Veras Date: Tue, 13 Oct 2026 11:33:04 -0400 Subject: [PATCH] Add Google Tag Manager, GA4 and the Search Console verification tag --- src/app/[lang]/layout.tsx | 5 +++++ src/components/analytics.tsx | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/components/analytics.tsx diff --git a/src/app/[lang]/layout.tsx b/src/app/[lang]/layout.tsx index e4c2568..1c7c74f 100644 --- a/src/app/[lang]/layout.tsx +++ b/src/app/[lang]/layout.tsx @@ -4,6 +4,7 @@ import { Inter, Noto_Sans_Arabic } from "next/font/google"; import "../globals.css"; import SiteHeader from "@/components/site-header"; import SiteFooter from "@/components/site-footer"; +import Analytics, { AnalyticsNoScript } from "@/components/analytics"; import { dirOf, locales, localize, ogLocale } from "@/i18n/config"; import { mainNav } from "@/i18n/nav"; import { getUI } from "@/i18n/server"; @@ -35,6 +36,8 @@ export async function generateMetadata(): Promise { title: { default: t.meta.title, template: "%s" }, description: t.meta.description, alternates: localeAlternates("/", locale), + // Google Search Console ownership. + verification: { google: "LnRawiMDpDtTVBC2X34We70f8OHBLMVC6e9IWoHCZLs" }, openGraph: { type: "website", url: localize("/", locale), @@ -70,6 +73,7 @@ export default async function RootLayout({ children }: LayoutProps<"/[lang]">) { data-scroll-behavior="smooth" > + {t.skip} @@ -79,6 +83,7 @@ export default async function RootLayout({ children }: LayoutProps<"/[lang]">) {
{children}
+ ); diff --git a/src/components/analytics.tsx b/src/components/analytics.tsx new file mode 100644 index 0000000..4494619 --- /dev/null +++ b/src/components/analytics.tsx @@ -0,0 +1,33 @@ +import Script from "next/script"; + +// Google Tag Manager and Google Analytics 4. Both share window.dataLayer. +const GTM_ID = "GTM-TP5FCVMQ"; +const GA_ID = "G-H7CB0B2RRS"; + +export default function Analytics() { + return ( + <> + + + + ); +} + +/** GTM's fallback for visitors with JavaScript turned off; goes right after opens. */ +export function AnalyticsNoScript() { + return ( +