Skip to content

Migrate to native Google Analytics (GA4) and simplify API keys#787

Merged
jamespepper81 merged 5 commits into
mainfrom
dev
Jun 23, 2026
Merged

Migrate to native Google Analytics (GA4) and simplify API keys#787
jamespepper81 merged 5 commits into
mainfrom
dev

Conversation

@jamespepper81

Copy link
Copy Markdown
Contributor

No description provided.

claude and others added 5 commits June 23, 2026 15:13
Migrate analytics from the Firebase SDK to native Google Analytics (GA4)
via @next/third-parties/google. The app only ever used Firebase for GA4,
so this removes the Firebase Installations dependency that required five
extra env vars.

Analytics now needs only NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID. The unused
NEXT_PUBLIC_FIREBASE_{API_KEY,APP_ID,AUTH_DOMAIN,PROJECT_ID,STORAGE_BUCKET,
MESSAGING_SENDER_ID} vars are removed from config, CI, deploy files, and docs.

- Mount <GoogleAnalytics> in the root layout (loads gtag.js)
- Rewrite useAnalytics().track() to use sendGAEvent (same signature)
- Rewrite AnalyticsTracker to send page_view on route change via sendGAEvent,
  skipping the initial render to avoid double-counting
- Delete src/lib/firebase.ts and drop the firebase npm dependency
  (@genkit-ai/firebase is unaffected)
- Simplify the in-app analytics-not-configured warning

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017hiMXdXjDgUWiCzuueiN3d
Migrate analytics from Firebase SDK to Google Analytics (GA4)
The OpenAI credential was referenced via two env vars: OPENAI_API_KEY and
the OPENAI_CHATGPT_API_KEY backward-compat fallback. The latter only existed
as an alias and, in both apphosting configs, mapped to the same OPENAI_API_KEY
secret. Consolidate on OPENAI_API_KEY (the documented standard and SDK
convention) so only one variable is referenced.

- src/ai/genkit.ts: drop the fallback, update warning and comment
- src/ai/flows/wallet-insights-chat.ts: drop the alias from error detection
  and the user-facing config message
- apphosting.dev.yaml / apphosting.prd.yaml: remove the alias env mapping

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014fbd2ZstdjJNhn3UQGjU5i
The comment claimed the code fails fast on a missing key, but it warns and
continues. Drop the misleading line and keep the accurate one.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014fbd2ZstdjJNhn3UQGjU5i
Remove OPENAI_CHATGPT_API_KEY fallback and simplify to OPENAI_API_KEY
@jamespepper81 jamespepper81 merged commit ba8b755 into main Jun 23, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants