Skip to content
Open
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
10 changes: 7 additions & 3 deletions app/components/Analytics.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
/**
* Google Analytics 4 — set NEXT_PUBLIC_GA_ID in env to enable.
* If unset (e.g. local dev), the component renders nothing.
* Google Analytics 4 — defaults to the TXLookup property (G-19ZRJ9T0CX).
* Override via NEXT_PUBLIC_GA_ID env (e.g. staging → different property).
* Set NEXT_PUBLIC_GA_ID="" explicitly to disable (e.g. local dev).
*
* Server component (no "use client") — emits the gtag bootstrap inline so
* the GA script loads early in the document.
*/
import Script from "next/script";

const DEFAULT_GA_ID = "G-19ZRJ9T0CX"; // TXLookup property (hackathon-acf11 / acct 3000023)

export function Analytics() {
const id = process.env.NEXT_PUBLIC_GA_ID;
const env = process.env.NEXT_PUBLIC_GA_ID;
const id = env === undefined ? DEFAULT_GA_ID : env;
if (!id) return null;
return (
<>
Expand Down
Loading