Migrate to native Google Analytics (GA4) and simplify API keys#787
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.