feat(analytics): GA4 + GSC verification, README hero#33
Merged
Conversation
Step 0 of the GTM plan ("没数据=盲飞") needs an analytics feedback loop.
The GSC verification meta and README hero from #31/#32 cover the rest;
this adds the missing piece — GA4.
- Analytics.tsx: GA4 via next/script (afterInteractive). Production-only
so dev/preview traffic never pollutes the data; public measurement ID
baked as default with NEXT_PUBLIC_GA_ID override, matching the
hardcoded-default + env pattern used for SITE_URL in lib/seo.
- layout: render <Analytics/> at the end of <body>.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
c88b34b to
04a8721
Compare
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.
Step 0 of the GTM plan — "没数据 = 盲飞". Wires up analytics + Search Console so growth gets a feedback loop, plus a README facelift for the stars flywheel.
Changes
Analytics.tsx— GA4 vianext/script(afterInteractive). Production-only so dev/preview traffic never pollutes the data. Public measurement ID (G-PPXV98MJ4Y) baked as the default with aNEXT_PUBLIC_GA_IDoverride — same hardcoded-default + env pattern asSITE_URLinlib/seo.layout.tsx— env-gatedgoogle-site-verificationmeta tag (GOOGLE_SITE_VERIFICATION), inert unless set; renders<Analytics/>at the end of<body>.README.md— centered hero: slogan, badges (stars / license / A2A / live), nav links, and the live OG image as the banner.Verification
tsc --noEmit✅ ·eslint✅config, and thegoogle-site-verificationmeta all render into the SSR'd HTML./badgepage all return 200 on production.Notes
cloudbuild.yaml.GOOGLE_SITE_VERIFICATIONtoken is required.🤖 Generated with Claude Code