~/.gemini/settings.json · open source (MIT) · ask in plain English

Add analytics to Gemini CLI.

Gemini CLI reads MCP servers from ~/.gemini/settings.json, or .gemini/settings.json for a single project, and gemini mcp add writes the entry for you. Point it at smolanalytics with your org token and you can ask funnels, retention, paths and what broke today straight from the terminal, including from a shell script, since gemini -p runs the same tools non-interactively.

~/.gemini/settings.json
gemini mcp add --transport http smolanalytics https://smolanalytics.com/api/mcp \
  --header "Authorization: Bearer YOUR_ORG_TOKEN"

# or write it by hand in ~/.gemini/settings.json
{
  "mcpServers": {
    "smolanalytics": {
      "url": "https://smolanalytics.com/api/mcp",
      "type": "http",
      "headers": { "Authorization": "Bearer YOUR_ORG_TOKEN" }
    }
  }
}

url with "type": "http" is the current shape and it is exactly what gemini mcp add writes. The older httpUrl key still connects but is deprecated in favor of url plus type, and with type omitted the CLI auto-detects the transport. Verify with /mcp inside the CLI or gemini mcp list outside it. Self-hosting? Swap url and headers for command: smolanalytics, args: ["mcp"].

how do I add analytics to gemini cli?

Gemini CLI reads MCP servers from ~/.gemini/settings.json, or .gemini/settings.json for a single project, and gemini mcp add writes the entry for you. Point it at smolanalytics with your org token and you can ask funnels, retention, paths and what broke today straight from the terminal, including from a shell script, since gemini -p runs the same tools non-interactively.

Gemini CLI lives in the terminal, and the non-interactive mode is what makes that useful here. gemini -p "using smolanalytics, what's notable in the last 24 hours for project acme?" is just a command, so it goes in a shell script, a cron entry or a CI step, and the morning read arrives without anyone opening a dashboard. A GEMINI.md at the repo root listing your real event names keeps it querying events you actually send instead of inventing metric names.

The token is an org token, so one entry covers every project: pass project="acme" to any of the 79 tools and it routes to that project's instance, with the read key staying server-side. Set trust: true on the server if you want it to skip the per-tool confirmation, which is reasonable because the tools are deterministic reports rather than generated SQL, and a CI agreement test asserts the CLI's answer, the dashboard's answer and the /v1 answer are identical for the same question.

Asking is separate from instrumenting. Connect your GitHub repo and we open an instrumentation PR for you to review and merge, or paste the one script tag. Once events flow you get the web side (pageviews, referrers, paths, heatmaps) and the product side (funnels, retention, cohorts, flags, experiments) from the same data, plus computed agent observability if what you are shipping is an agent. Answers run on the Gemini model you already have, so we never meter the AI. Open source (MIT), self-host free or $49/mo for 1M events.

Honest pricing: 14-day full trial, no credit card. Then Pro $49/mo, never metered on seats or sites. Overage is $8/million with an emailed receipt, the dashboard never locks, and self-hosting the single Go binary is free forever (MIT).

Add analytics to Gemini CLI tonight.

One snippet, or one endpoint. Tomorrow morning the verdict tells you which part of the funnel to fix.

questions

How do I add analytics to Gemini CLI?
Gemini CLI reads MCP servers from ~/.gemini/settings.json, or .gemini/settings.json for a single project, and gemini mcp add writes the entry for you. Point it at smolanalytics with your org token and you can ask funnels, retention, paths and what broke today straight from the terminal, including from a shell script, since gemini -p runs the same tools non-interactively.
Do I need a cookie banner?
Not in cookieless mode. smolanalytics can run without storing anything on the device, so there is no consent banner to add. You still get visitors, referrers, funnels, retention, and paths, and AI-assistant referrals (chatgpt.com, claude.ai, perplexity.ai) show up as their own channel.
Is it enough for a real product, or just page counts?
It does funnels, retention, paths, cohorts, and a daily verdict on what to fix, from the same events, and you ask it in plain English. It also ships feature flags, A/B experiments, click heatmaps, in-product surveys, and a session inspector that replays a user's journey from their events; the one thing it skips is pixel-perfect DOM session recording. If you want a straight answer on what to fix, plus the full toolkit, that you own and can self-host free, it fits.

keep reading