From c000b2fd9325fc80a929678d3d99ff4eedf5a7db Mon Sep 17 00:00:00 2001 From: Alex S <27193857+askov@users.noreply.github.com> Date: Mon, 25 May 2026 20:15:15 +0700 Subject: [PATCH] feat(analytics): add client-side gtag.js to root layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Render the GA4 gtag.js snippet from app/layout.tsx so page views and client interactions land in the same GA4 property the server-side Measurement Protocol code already writes to. Complements the server-side trackEvent path in lib/analytics.ts — together they cover both surface areas (page views from the client, airdrop outcomes from the API route) without double-counting. Uses next/script with strategy="afterInteractive" rather than raw + + )} ); diff --git a/types.d.ts b/types.d.ts index 43e2ba4..918afe4 100644 --- a/types.d.ts +++ b/types.d.ts @@ -43,6 +43,14 @@ declare namespace NodeJS { GA4_MEASUREMENT_ID: string; GA4_API_SECRET: string; + /** + * Client-side analytics (gtag.js). Optional — the GA4