# BetterMeter > BetterMeter is a privacy-first analytics platform for the AI era. It tracks websites, CLI tools, MCP servers, and APIs through a unified, cookie-free pipeline. BetterMeter is an alternative to Google Analytics built for developers who ship AI-powered products. ## What is BetterMeter? BetterMeter is a web and developer tool analytics platform designed for the AI-first internet. Unlike traditional analytics (Google Analytics, Plausible, Fathom), BetterMeter tracks not just website visitors but also CLI tool usage, MCP server tool invocations, and API endpoint traffic — all in one dashboard. BetterMeter answers questions that traditional analytics cannot: - How much traffic comes from ChatGPT, Claude, Perplexity, and other AI platforms? - Which AI crawlers (GPTBot, ClaudeBot, etc.) are indexing your site, and how often? - Which CLI commands do developers use most? What is the error rate? - Which AI clients (Claude Code, Cursor, Windsurf) invoke your MCP server tools? - Which API endpoints are slowest? What is the error rate by endpoint? - How do LLMs describe your brand in AI search results? - Which source and campaign first acquired this person, how many sessions have they returned for, and are they now an active customer? ## Key Differentiators - **AI Traffic Attribution**: Identifies visitors referred by ChatGPT, Claude, Perplexity, Gemini, and Copilot. No other analytics platform does this. - **Four Source Types**: Tracks websites, CLI tools, MCP servers, and APIs through the same pipeline. - **Privacy by Default**: Anonymous tracking uses no cookies or local storage, no fingerprinting, and no raw IP storage. Durable identity is an explicit integrator action. - **MCP Server Native**: BetterMeter itself runs as an MCP server, so AI assistants can query your analytics directly. - **Search Rankings & AI Visibility**: Tracks your Google search rankings, monitors how AI chatbots mention your brand, and analyzes your backlink profile. - **Shareable Analytics Filters**: Traffic, Audience, Agents, and Visibility support URL-persistent date ranges, search, and contextual facets for channels, engagement, visitor type, geography, automation health, rankings, mentions, and backlink authority. - **Honest Human Traffic**: Human-traffic metrics exclude known bots, explicit headless automation, and conservative high-confidence scraper cohorts by default. Overview shows the excluded count and can include automation again for investigation. - **Builder Studio**: Creates saved custom dashboards and reusable report templates for founder/operator reporting. - **Person-Level Acquisition**: Preserves each person's all-time first-touch source, campaign, and landing page; shows repeat sessions; and supports lead/customer lifecycle status. - **Live Mode**: Follows active human visitors through pageviews, custom events, and goal conversions; its Big Screen companion renders the same sanitized stream as a full-viewport physics constellation with a rewindable 30-minute event timeline, without screen recording, raw IPs, or query strings. ## Features ### AI Traffic Attribution See exactly how many visitors come from ChatGPT, Claude, Perplexity, Gemini, and Copilot. Understand which AI platforms drive real engagement to your site. BetterMeter detects AI referrals by parsing referrer headers and user agent strings for known AI platform patterns. - [Learn more](https://analytics.paraito.ca/features/ai-traffic-attribution) ### Bot & Crawler Analytics Track GPTBot, ClaudeBot, Googlebot, and 126 crawler signatures across 12 categories. Know which bots hit your site, how often, and which pages they index. Filter by category: AI crawlers, search engines, monitoring bots, and scrapers. - [Learn more](https://analytics.paraito.ca/features/bot-crawler-analytics) ### CLI Analytics Track how developers use your CLI tool. See top commands, error rates, execution duration, CI vs local usage, and usage trends over time. Integrates with Commander.js via auto-wrapping or manual tracking. - [Learn more](https://analytics.paraito.ca/features/cli-analytics) ### MCP Server Analytics Track which tools AI clients invoke on your MCP server. See Claude vs Cursor vs Windsurf breakdown, success rates, latency, and token usage. Auto-wraps MCP server tool handlers with zero code changes. - [Learn more](https://analytics.paraito.ca/features/mcp-analytics) ### API Analytics Monitor API endpoints with Express middleware or manual tracking. See top endpoints, error rates, latency, and caller patterns. One line to add to an Express app. - [Learn more](https://analytics.paraito.ca/features/api-analytics) ### Privacy-First Analytics Anonymous tracking uses no cookies or local storage, stores no raw IP, and does no fingerprinting unless explicitly enabled with `data-fingerprint="true"`. Calling `identify()` explicitly stores that site's opaque ID in local storage until `reset()`; integrators must avoid direct personal data and apply applicable consent rules. The tracker forwards only recognized UTM and ad click parameters for campaign attribution; unrelated query values stay in the browser, and page URLs and referrers are stored without query strings or fragments. Click-ID values are not persisted unless `data-attribution="true"` is set, which parks the most recent ad click in local storage for 90 days and writes it to the visitor as `bm_*` properties; that opt-in is suppressed under DNT/GPC and captures nothing the tracker was not already forwarding. IP addresses are HMAC-SHA-256 hashed with `VISITOR_HASH_SECRET` and daily rotation. - [Learn more](https://analytics.paraito.ca/features/privacy-first-analytics) ### Live Mode Real-time human visitor journeys powered by activity-gated heartbeats and a bounded Redis event stream. The browser tracker sends a heartbeat every 30 seconds while the tab is visible and the user is active; presence expires after 60 seconds. Sanitized non-bot pageviews and custom events power the recent activity feed and goal matching. Opt out of presence tracking with the `data-no-heartbeat` attribute on the script tag. - Dashboard: `/dashboard/live` with active visitors, selected journey, activity feed, and optional goal conversion sound/effects; `/dashboard/live/display?site=...` adds a physics-based wall display with source clusters, event ripples, conversion bursts, and a 30-minute flight-recorder timeline that can rewind, replay, and return to live - CLI: `bettermeter live -s [--activity] [--cursor ] [--json]` - CLI display URL: `bettermeter live:screen -s [--json]` - MCP: `bettermeter_live_visitors` with optional `activity=true` and `cursor` - MCP display URL: `bettermeter_live_display` - API: `GET /api/analytics/live?siteId=...&activity=1&cursor=...` returns live count, visitor IDs, recent events, a cursor, and initial goal definitions - Privacy: no screen recording, keystrokes, session video, raw IPs, or query strings ### Site Portfolio One view of every site the caller can access, rather than one site at a time: each site's visitors, pageviews, sessions and custom events for the range, its period-over-period visitor change where a previous period exists, and the account-wide totals underneath. Nothing here takes a site id — the population is "every site you have access to", so it answers "how is everything doing" without a call per site. - Dashboard: `/dashboard` - CLI: `bettermeter all-sites [-r ] [--json]` — the one analytics command that takes no `-s/--site` - MCP: `bettermeter_all_sites` with optional `range`; no `site_id` - API: `GET /api/analytics/all-sites` — takes `?from=...&to=...` only ### Conversion Goals & Evolution Define pageview, custom-event, outbound-link, or download goals and evaluate them retroactively. Known and high-confidence automated traffic is excluded by default. Stable identified-person links prevent rotating anonymous hashes from inflating unique converters; source, campaign, channel, and landing page come from each person's all-time first human pageview. Each goal compares the selected calendar window with the immediately preceding equal-length window, showing daily or cumulative conversions, conversion rate, growing/declining/mixed momentum, best day, concentration, repeat activity, the highest-volume path, and the most efficient path with enough exposed traffic to trust. Values in different currencies are never added together. - Pulse can retrieve the latest concrete goal-completion events as linked visitor records with first-touch acquisition, visit count, and the actions leading into each conversion. Visitor links open the complete profile timeline. - Dashboard: `/dashboard/goals` and `/dashboard/goals/[goalId]` - CLI: `bettermeter goals`, `bettermeter goal:show -s -g `, `bettermeter goal:create`, `bettermeter goal:update`, `bettermeter goal:delete`, `bettermeter goals:suggest`; read commands accept `--include-bots` - MCP: `bettermeter_goals`, `bettermeter_goal_detail`, `bettermeter_create_goal`, `bettermeter_update_goal`, `bettermeter_delete_goal`, `bettermeter_suggest_goals`; read tools accept `include_bots` - API: `GET|POST /api/analytics/goals`, `GET|PATCH|DELETE /api/analytics/goals/[goalId]`, `GET /api/analytics/goals/suggest` ### Search Rankings & AI Visibility Track your Google search rankings, see how ChatGPT, Perplexity, Gemini, Copilot, and Grok mention your brand, and monitor your backlink profile. Visibility score (0-100), competitor comparison, and ranking alerts. - [Learn more](https://analytics.paraito.ca/features/brand-monitoring) ### Pulse AI Proactive analytics intelligence that works while you sleep. Pulse automatically detects anomalies (traffic spikes/drops, error rate changes, bot surges, new referrer sources), surfaces actionable insights (trends, growth opportunities, milestones), computes a unified product health score (0-100, grade A-F), forecasts traffic trends with confidence intervals, compares time periods, and delivers daily or weekly briefings. Person-level conversion answers use adaptive visitor cards in narrow docks, compact dates, and direct profile links. Set up monitoring alerts to get notified when conditions are met. - Chat model: `google/gemini-3.7-flash` through OpenRouter by default; override with `PULSE_AI_MODEL` - Dashboard: Pulse slide-out panel with Briefing, Insights, Forecast, and Alerts tabs, plus in-page insight callouts on the Traffic, Marketing, Audience and Visibility hubs and on custom dashboards — each filtered to the metrics that surface is about, and each offering a one-click follow-up question that carries the page and date range into the chat - Insight coverage: traffic anomalies (visitors, pageviews, sessions, AI referrals), declining pages, fast-growing referrers, visitor milestones, AI-heavy pages, bot probing of sensitive paths, campaign shifts, channel-mix shifts, geographic shifts, conversion-event trends, and engagement/bounce shifts. All computed statistically from your own data — no LLM call and no token cost per view - CLI: `bettermeter pulse ask|threads|thread|thread-delete|insights|health|briefing|forecast|compare|alerts` - MCP: `bettermeter_pulse_ask`, `bettermeter_pulse_threads`, `bettermeter_pulse_thread`, `bettermeter_pulse_thread_delete`, `bettermeter_pulse_insights`, `bettermeter_pulse_health`, `bettermeter_pulse_briefing`, `bettermeter_pulse_forecast`, `bettermeter_pulse_compare`, `bettermeter_pulse_alerts_list`, `bettermeter_pulse_alerts_create`, `bettermeter_pulse_alerts_delete`, `bettermeter_pulse_notifications` - API: `GET /api/pulse/insights|health|briefing|forecast|compare|alerts|notifications|conversations|screenshot`, `POST /api/pulse/chat`, `POST /api/pulse/conversations`. The screenshot endpoint also powers lazy landing-page previews in Marketing and campaign detail. ### Builder Studio Saved custom dashboards and report templates for founder/operator workflows. Dashboards are edited in a CMS-style drag-and-drop widget canvas, persist widget layouts, appear in the authenticated left navigation with widget submenus, and render live at `/dashboard/custom/[dashboardId]`. The `paidPerformance` widget and `paidMedia` report section read live Meta delivery, preserve per-currency spend, and require Editor or Admin access. Report templates persist sections, format, schedule, and recipients while live metrics continue to come from the analytics APIs. - Dashboard: `/dashboard/builder`, `/dashboard/custom/[dashboardId]` - CLI: `bettermeter dashboards`, `bettermeter dashboard:create`, `bettermeter dashboard:update`, `bettermeter dashboard:delete`, `bettermeter reports`, `bettermeter report:create`, `bettermeter report:preview`, `bettermeter report:update`, `bettermeter report:delete` - MCP: `bettermeter_dashboards`, `bettermeter_create_dashboard`, `bettermeter_update_dashboard`, `bettermeter_delete_dashboard`, `bettermeter_reports`, `bettermeter_create_report`, `bettermeter_report_preview`, `bettermeter_update_report`, `bettermeter_delete_report` - API: `/api/builders/dashboards`, `/api/builders/reports`, `/api/builders/reports/preview` ### Analytics Filter Workspace The Traffic, Audience, Agents, and Visibility hubs expose one consistent responsive filter workspace. Date range, active tab, search, and contextual facets are stored in the URL so an investigation survives refresh and can be shared with teammates. The Overview graph also stores its range in the URL and returns the complete selected calendar window, including zero-activity dates. Traffic filters pages by engagement, sources by AI attribution, and campaigns by channel and volume. Audience filters people and sessions by type, intent, and country. Agents filters crawlers and developer-tool activity by category and health. Visibility filters AI traffic, ranking coverage, mention presence, and backlink authority. ## Integrations BetterMeter tracks four event sources through a single pipeline: | Source | Integration | Event | |--------|------------|-------| | Website | ` ``` ### Track Custom Events (Web) ```javascript window.bettermeter.track("signup", { plan: "pro" }); window.bettermeter.identify("user_123"); // Ad click attribution (opt in with data-attribution="true") window.bettermeter.captureAttribution(); // park the click ID on this URL (also reads Meta's _fbp cookie) window.bettermeter.getAttribution(); // { bm_gclid, bm_fbclid, bm_fbc, bm_utm_source, ... } window.bettermeter.fillAttributionFields(); // fill matching hidden inputs ``` ### Track a CLI Tool ```typescript import { BetterMeter } from "@bettermeter/node"; const bm = new BetterMeter({ siteId: "my-cli", apiKey: "bm_..." }); // Auto-track all Commander.js commands bm.wrapCommander(program, { version: "1.0.0" }); // Or track manually bm.trackCommand({ command: "deploy", flags: ["--prod"], durationMs: 3400, exitCode: 0, }); ``` ### Track an MCP Server ```typescript import { BetterMeter } from "@bettermeter/node"; const bm = new BetterMeter({ siteId: "my-mcp", apiKey: "bm_..." }); // Auto-track all tool invocations (zero code changes to existing tools) bm.wrapMcpServer(server); // Or track manually bm.trackTool({ tool: "search_docs", client: "claude-code", durationMs: 250, success: true, }); ``` ### Track an API ```typescript import { BetterMeter } from "@bettermeter/node"; const bm = new BetterMeter({ siteId: "my-api", apiKey: "bm_..." }); // Express middleware (one line) app.use(bm.expressMiddleware()); // Or track manually bm.trackApi({ method: "GET", endpoint: "/api/users", statusCode: 200, durationMs: 45, }); ``` ## Node SDK — @bettermeter/node Install: `npm install @bettermeter/node` Zero dependencies. Requires Node.js 18+. ### Constructor `new BetterMeter(config)` | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | siteId | string | Yes | Domain or identifier registered in BetterMeter | | apiKey | string | Yes | API key from dashboard (starts with bm_) | | apiUrl | string | No | API URL. Default: https://bettermeter.com. Remote custom URLs are blocked unless explicitly allowed. | | allowCustomApiUrl | boolean | No | Allow a trusted custom HTTPS API URL for self-hosted deployments | | disabled | boolean | No | Disable tracking. Default: false | | batch | boolean | No | Queue events and flush on interval. Default: false | | batchInterval | number | No | Flush interval in ms. Default: 5000 | | hashUserId | boolean | No | Hash custom user IDs before sending. Default: true | | redactProperties | boolean | No | Redact sensitive custom property keys before sending. Default: true | ### Methods - `trackCommand(opts)` — Track a CLI command invocation - `trackTool(opts)` — Track an MCP tool invocation - `trackApi(opts)` — Track an API request - `wrapCommander(program, opts?)` — Auto-track all Commander.js commands - `wrapMcpServer(server)` — Auto-track all MCP tool calls on an McpServer instance - `expressMiddleware()` — Returns Express/Connect middleware for API tracking - `reportBotVisit(request, siteId, options?)` — Server-side bot detection for Next.js/Edge middleware (import from `@bettermeter/node/middleware`) - `flush()` — Send all queued events immediately - `shutdown()` — Stop batch timer and flush. Call before process exit. ### Environment Variables - `BETTERMETER_DISABLED=1` — Disable tracking globally (useful for tests) - `BETTERMETER_ALLOW_CUSTOM_API_URL=1` — Allow trusted custom SDK API URLs for self-hosted deployments ## CLI Install: `npm install -g bettermeter` The CLI renders rich visual output by default — ASCII line charts for timeseries, horizontal bar charts for ranked data, sparklines in overview stat cards, and styled tables with box-drawing borders. Colors auto-detect terminal capabilities and respect `NO_COLOR`. Use `--json` for raw JSON output (ideal for scripting or piping to `jq`). All analytics commands accept: `-s/--site `, `-r/--range `, `--json` — except `all-sites`, which is account-wide and takes `-r/--range` and `--json` but no `-s/--site`. Range presets include exactly their labeled number of calendar dates and compare against the immediately preceding equal-length window. `-l/--limit ` is accepted only by the commands that return a ranked list: `pages`, `sources`, `bots`, `countries`, `browsers`, `visitors`, `sessions`, `events`, `campaigns`, `conversions`, `keywords`, `campaign:visitors`, `export`, `cli-commands`, `mcp-tools`, `mcp-clients`, `api-endpoints`. It has no default of its own: omit it and the command returns the endpoint's own default page, which differs per dataset, and pass it to ask for a specific number of rows. The summary, trend and detail commands do not accept it — `stats`, `ai-traffic`, `timeseries`, `devices`, `channels`, `marketing`, `ads`, `campaign`, `event`, and the `cli-`, `mcp-` and `api-` overview and timeseries commands. On `sources --filter` and `bots --category` the limit is applied before the filter, so a filtered result can hold fewer rows than the limit. ### Real-Time - `bettermeter live -s [--activity] [--cursor ] [--json]` — Live visitor count and optional recent human journey activity - `bettermeter live:screen -s [--json]` — Authenticated Big Screen URL for the rewindable physics-based live visitor display ### Authentication - `bettermeter login -t -u ` — Authenticate with API key and dashboard URL - `bettermeter logout` — Remove stored credentials - `bettermeter whoami` — Show current authenticated user ### Portfolio - `bettermeter all-sites [-r ] [--json]` — Traffic for every site you can access, side by side: visitors, pageviews, sessions and custom events per site, each site's period-over-period visitor change, and the account-wide totals. It takes no `-s/--site`, because the population is every site the API key can reach ### Web Analytics - Human-traffic commands exclude known and high-confidence automated traffic by default. Add `--include-bots` to stats, pages, sources, ai-traffic, timeseries, countries, devices, browsers, sessions, session-stats, channels, goals, goal:show, or goals:suggest for unfiltered totals. - `bettermeter stats` — Overview: visitors, pageviews, sessions + period-over-period change; empty previous periods are labeled as a new baseline - `bettermeter pages` — Top pages by visitor count - `bettermeter sources` — Traffic sources (--filter all|ai|traditional) - `bettermeter ai-traffic` — AI referral breakdown by platform - `bettermeter bots` — Bot/crawler traffic (--category all|ai-crawler|search|monitoring|scraper) - `bettermeter timeseries` — Daily visitor and pageview trend - `bettermeter countries` — Visitors by country - `bettermeter devices` — Device type breakdown - `bettermeter browsers` — Browser breakdown - `bettermeter visitors` — People with an event-source column naming each person's primary source (web / cli / mcp / api, or bot) and how many others they used, the source-specific detail (which MCP client, CLI command, API endpoint or crawler), plus first-touch attribution, repeat sessions, and lifecycle - `bettermeter sessions` — Session quality: every session's duration, pageviews, custom events, entry-to-exit path, engagement tier and bounce, under period totals (sessions and change, average quality score, bounce rate and change, average duration, average pages per session) - `bettermeter visitor:find -s [--email ] [--crm-id ] [--key --value ]` — Find a visitor by email, CRM contact id, or exact property key/value - `bettermeter visitor ` — One person's acquisition and activity profile - `bettermeter visitor:update --user-id --name --status ` — Update identity/lifecycle (Editor or Admin) - `bettermeter visitor:properties ` — List the key/value properties stored on a visitor - `bettermeter visitor:tag --set key=value --remove key` — Set or remove arbitrary visitor properties (Editor or Admin) - `bettermeter events` — Custom events with counts - `bettermeter event ` — One custom event in depth: total fires, unique visitors, the breakdown of property values by count, and the most recent fires with visitor, path and country - `bettermeter campaigns` — Automatically captured campaign URL attribution (UTM + click IDs) - `bettermeter campaign ` — Detailed campaign report: visit quality, variant/keyword performance, device/browser/country breakdowns, hourly pattern, custom events - `bettermeter keywords` — Keywords driving traffic (utm_term, with visit quality) - `bettermeter campaign:visitors ` — Everyone one campaign brought in: who clicked, the page they landed on, their variant, device and country, and what they did afterwards - `bettermeter marketing` — Full marketing report: campaigns, landing pages, channel mix and campaign vs non-campaign traffic - `bettermeter screenshot -s [--output file]` — Capture one landing page as an image - `bettermeter channels` — Channel breakdown (Direct, Paid Search, Organic, etc.) - `bettermeter export` — Full analytics report (--format json|csv|md) ### CLI Analytics - `bettermeter cli-overview` — CLI usage summary: invocations, callers, success rate, avg duration - `bettermeter cli-commands` — Top CLI commands by invocation count - `bettermeter cli-timeseries` — CLI daily activity trend ### MCP Analytics - `bettermeter mcp-overview` — MCP usage summary: invocations, callers, success rate, avg duration - `bettermeter mcp-tools` — Top MCP tools by invocation count - `bettermeter mcp-clients` — MCP client breakdown (Claude, Cursor, Windsurf, etc.) - `bettermeter mcp-timeseries` — MCP daily activity trend ### API Analytics - `bettermeter api-overview` — API usage summary: invocations, callers, error rate, avg duration - `bettermeter api-endpoints` — Top API endpoints by invocation count - `bettermeter api-timeseries` — API daily activity trend ### Builder - `bettermeter dashboards` — List saved custom dashboards - `bettermeter dashboard:create` — Create a custom dashboard layout - `bettermeter dashboard:update -i ` — Update a saved dashboard layout; only the flags you pass change - `bettermeter dashboard:delete` — Delete a custom dashboard layout - `bettermeter reports` — List saved report templates - `bettermeter report:create` — Create a report template - `bettermeter report:preview` — Preview a report without saving it - `bettermeter report:update -i ` — Update a saved report template; only the flags you pass change - `bettermeter report:delete` — Delete a report template ### Search Rankings & AI Visibility - `bettermeter brand-report -q ` — Generate search rankings visibility report (1-10 queries) - `bettermeter brand-config ` — View or update search rankings configuration - `bettermeter brand-compare -q ` — Compare rankings vs competitors (1-10 queries, up to 10 competitors) - `bettermeter brand-alerts ` — Manage ranking alert rules (list, create, delete, enable, disable) - `bettermeter ai-mentions -q ` — Check brand mentions across AI chatbots (1-10 queries). Runs a NEW paid scan - `bettermeter ai-mentions:history [domain]` — Stored AI mention scans, newest first, with the change against the scan before each. Reads history; never spends a scan - `bettermeter backlinks ` — Backlink profile: domain rank, referring domains, new/lost links ### Paid Media - `bettermeter ads` — Per-currency Meta spend and link clicks joined by normalized campaign name to tracked traffic, with match status and supported cost ratios - `bettermeter ad-connections -s ` — Connected ad accounts and their sync health. List only: connecting an account takes a token that can spend money and is entered in the dashboard - `bettermeter ads:sync -s ` — Pull ad spend from Meta now instead of waiting for the nightly sync - `bettermeter ad-creative -s [--campaign ] [--utm-content ] [--list]` — The ad behind a visit, or every ad in a campaign. Reports whether the match is exact or campaign-level ### CRM Revenue - `bettermeter conversions [--won]` — CRM records carrying one of our ad click IDs, with matched, unmatched and awaiting-upload counts - `bettermeter crm -s ` — Connected CRMs and their sync health - `bettermeter crm:sync -c [--full]` — Pull CRM conversions now ### Slack Alerts - `bettermeter slack -s ` — Slack channels wired to Pulse alerts, with delivery health - `bettermeter slack:connect -s -u [-c