Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/components/site/Analytics.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
6 changes: 6 additions & 0 deletions src/lib/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
Loading