diff --git a/src/components/site/Analytics.tsx b/src/components/site/Analytics.tsx index 42a313d..b989a58 100644 --- a/src/components/site/Analytics.tsx +++ b/src/components/site/Analytics.tsx @@ -1,14 +1,15 @@ import Script from "next/script"; +import { site } from "@/lib/site"; /** * Google Analytics 4. Replaces the old Universal Analytics tag * (UA-121652877-4), which Google shut down in 2023 and which collects nothing. * - * Off unless NEXT_PUBLIC_GA_MEASUREMENT_ID (a "G-..." ID) is set at build time, - * and never loaded in development. Ads storage is denied; no personal data is + * Uses site.gaMeasurementId (src/lib/site.ts), or NEXT_PUBLIC_GA_MEASUREMENT_ID + * to override it. Off when neither is set, and never loaded in development. Ads storage is denied; no personal data is * sent by the site itself. */ -const id = process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID; +const id = process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID || site.gaMeasurementId; export function Analytics() { if (!id || process.env.NODE_ENV !== "production" || !/^G-[A-Z0-9]+$/.test(id)) return null; diff --git a/src/lib/site.ts b/src/lib/site.ts index 04a8d43..f2f015f 100644 --- a/src/lib/site.ts +++ b/src/lib/site.ts @@ -14,6 +14,12 @@ export const site = { repo: "https://github.com/flutterph/flutterph.github.io", /** Primary call to action. go.flutter.ph/join is a separate redirect service; keep its DNS record untouched. */ joinUrl: "https://go.flutter.ph/join", + /** + * Google Analytics 4 measurement ID ("G-..."). Public by design: it ships in every page. + * Property "Flutter Philippines - GA4" (382764891), web stream for https://flutter.ph. + * It replaces Universal Analytics UA-121652877-4, which Google retired in 2023. + */ + gaMeasurementId: "G-YF5SJSL54Q", /** Wording required by the Flutter brand guidelines for community websites (docs.flutter.dev/brand). */ affiliation: "Flutter and the related logo are trademarks of Google LLC. We are not endorsed by or affiliated with Google LLC.",