DEV Community

Cover image for I built web analytics with no dashboard, only an MCP
Henrik Holen
Henrik Holen

Posted on

I built web analytics with no dashboard, only an MCP

A while back I built an analytics tool. It had two ideas: it was cheap, and it sent you an AI summary every Sunday. Turns out cheap made no difference, but the few people who used it liked the AI summary a lot more than the dashboard.

So I threw away the dashboard and rebuilt the whole thing as an MCP server. 42 tools that AI coding agents (Claude Code, Cursor, Codex) can call directly. Traffic, sources, funnels, session paths, events, performance. The agent asks questions, the tools return compact JSON.

The idea is simple: your coding agent already has your codebase, your database, and your git history. Adding traffic data gives it one more layer of context. The analytics isn't something you go and check, it's context the agent uses while it works.

The basic implementation

You're building a new landing page and your agent already knows your traffic patterns. It can tell you that /blog/why-acme converts at 12% while /docs gets 189 views and zero signups. You don't ask for a report, the agent just has that context available when it's making suggestions.

Or you deploy a change and ask "did anything break?" The agent calls get_snapshot, compares to yesterday, and tells you bounce rate spiked 15% on the pricing page. That's a 30-second conversation instead of opening a dashboard, finding the right view, selecting the right date range.

The CLAUDE.md experiment

The part I found most interesting was getting the agent to use analytics unprompted. I tested three approaches:

  1. No instructions — agent never touched analytics
  2. Full paragraph explaining what Lodd is and when to use it — agent added tracking to new features
  3. Three lines near the top of CLAUDE.md pointing to a skill file — agent added tracking to new features, same as the verbose version

Position mattered more than length. The same three lines buried at line 172 didn't work. At line 17 they did. The agent reads the whole file, but early instructions seem to carry more weight.

That's three lines of config and your agent starts adding analytics tracking to every new page and feature without being asked.

Some details

  • Responses use shortened keys (v not visitors) to save context window tokens. A full snapshot is about 55 tokens.
  • 49 REST API endpoints for automation workflows (scheduled reports, Slack alerts, GitHub issue creation when traffic drops).
  • No cookies, country-only geolocation, hashed IPs. GDPR compliant without consent banners.
  • 2KB tracking script with SPA support built in.
  • Free up to 2,500 events/month, €9.99/month for 100K.

Limitations

No dashboard. If you need charts for a board meeting, this isn't the right tool. It's newer and less battle-tested than Plausible or Fathom. No self-hosting option.

Try it

Install the MCP server:

npx -y @lodd/mcp-server
Enter fullscreen mode Exit fullscreen mode

Or point your coding agent at lodd.dev/llms.txt and let it figure out the setup.

The REST API docs are at lodd.dev/api if you want to build automations. I wrote a tutorial on automating monthly reports with Trigger.dev if that's your thing.

lodd.dev

Top comments (0)