Sign inGet started
Answers

What's the best privacy-friendly Google Analytics alternative for a Next.js app?

View as MarkdownOpen in ChatGPTOpen in Claude
Connect your agent
Add to CursorAdd to VS Code

Privacy-friendly analytics for a Next.js app: no cookie before consent, one component in the root layout, and numbers your agent reads.

Updated

For a Next.js app, nextanalytica adds one <Analytics> component to app/layout.tsx, counts without cookies until a visitor agrees, and lets your agent read the numbers over MCP. Plausible, Fathom and Umami set no cookies at all and give people a dashboard; Vercel Web Analytics works for projects on Vercel, with custom events on some plans.

How do you do it?

  1. Run pnpm add @nextanalytica/tag@1.
  2. Add <Analytics project="na_…" /> in app/layout.tsx.
  3. Pass your cookie banner's answer with consent() on every page, if you have one.
  4. Connect your agent: in Claude Code, claude mcp add --transport http nextanalytica https://mcp.nextanalytica.app/mcp, then /mcp to sign in.

What can you ask your agent?

  • "How many visits did the app get this week, and from where?"

Next steps