From 375fba09b0baa29b2991c59d0d72587d5b4c3bc0 Mon Sep 17 00:00:00 2001 From: Joshua de Guzman Date: Fri, 20 Nov 2026 22:53:41 +0800 Subject: [PATCH 1/2] feat(analytics): read the GA4 measurement ID from site config --- src/components/site/Analytics.tsx | 7 ++++--- src/lib/site.ts | 6 ++++++ 2 files changed, 10 insertions(+), 3 deletions(-) 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..a256434 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. + * The old site used Universal Analytics UA-121652877-4, which Google retired in 2023. + * TODO(content): paste the GA4 ID from Google Analytics > Admin > Data streams > Web. + */ + gaMeasurementId: "", /** 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.", From a72b321eaef931557c7be30fe934fd02cecd1145 Mon Sep 17 00:00:00 2001 From: Joshua de Guzman Date: Fri, 20 Nov 2026 22:57:13 +0800 Subject: [PATCH 2/2] feat(analytics): enable GA4 (G-YF5SJSL54Q) for flutter.ph --- src/lib/site.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/site.ts b/src/lib/site.ts index a256434..f2f015f 100644 --- a/src/lib/site.ts +++ b/src/lib/site.ts @@ -16,10 +16,10 @@ export const site = { joinUrl: "https://go.flutter.ph/join", /** * Google Analytics 4 measurement ID ("G-..."). Public by design: it ships in every page. - * The old site used Universal Analytics UA-121652877-4, which Google retired in 2023. - * TODO(content): paste the GA4 ID from Google Analytics > Admin > Data streams > Web. + * Property "Flutter Philippines - GA4" (382764891), web stream for https://flutter.ph. + * It replaces Universal Analytics UA-121652877-4, which Google retired in 2023. */ - gaMeasurementId: "", + 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.",