Skip to content

Replace dead react-ga with @vercel/analytics#45

Open
dawsbot wants to merge 1 commit into
masterfrom
fix/dead-analytics
Open

Replace dead react-ga with @vercel/analytics#45
dawsbot wants to merge 1 commit into
masterfrom
fix/dead-analytics

Conversation

@dawsbot

@dawsbot dawsbot commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Why

utils/analytics.js + components/layout.js wire up react-ga v3, which targets Google Universal Analytics — sunset July 2023. The site has been sending pageviews/events into the void for ~3 years.

What

  • Removed react-ga, utils/analytics.js, the initGA/logPageView useEffect in components/layout.js, and the logEvent calls in pages/index.js (custom events aren't part of the zero-config Web Analytics free tier, so they were dropped rather than ported).
  • Added @vercel/analytics and a new pages/_app.js that renders <Analytics /> (imported from @vercel/analytics/next), per the Next.js pages-router quickstart. Zero config since the site is Vercel-hosted — just enable Web Analytics in the project dashboard if it isn't already.

preact/compat note

next.config.js aliases React to preact/compat in client production builds. <Analytics /> from @vercel/analytics/next uses Suspense plus next/navigation hooks, both of which preact/compat / Next pages-router support. next build (which runs the preact-aliased client compile) passes cleanly, so no gating was needed. Caveat: verified at build time only, not in a live browser session — worth a one-click check in Vercel preview that /_vercel/insights/script.js loads.

Verification

  • next build passes (client bundle compiled with the preact alias)
  • eslint . — no new warnings (3 pre-existing warnings untouched)

🤖 Generated with Claude Code

react-ga v3 targets Google Universal Analytics, which was sunset in
July 2023, so the site has collected no analytics data since then.

- Remove react-ga, utils/analytics.js, and all initGA/logPageView/
  logEvent wiring in components/layout.js and pages/index.js
- Add @vercel/analytics and render <Analytics /> from a new
  pages/_app.js per the Next.js pages-router docs (zero-config on
  Vercel hosting)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mailto Ready Ready Preview, Comment Jul 6, 2026 7:04pm

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.

1 participant