← MetricMind

Docs

Everything MetricMind measures starts with one script tag. Everything you can read in the dashboard is also available to your code and your AI tools.

Install

Add the script to every page’s <head>. Your site ID is in the dashboard under Settings → Setup, together with a one-line prompt for Claude Code, Cursor or Codex that does the install for you.

<script src="https://cdn.metricmind.si/mm.js" data-site="YOUR_SITE_ID" defer></script>

Page views (including single-page app navigations), engaged time, Web Vitals (LCP, INP, CLS, FCP, TTFB), JavaScript errors, outbound links and contact clicks are collected automatically. No cookies. Events are batched and sent with sendBeacon when the tab closes.

With a Content-Security-Policy, allow https://in.metricmind.si in connect-src, and https://cdn.metricmind.si in script-src unless you load the script from a nonced inline loader with 'strict-dynamic'.

Script options

  • data-site: your site ID (required).
  • data-vitals="false", data-errors="false", data-outbound="false", data-contacts="false": turn a collector off.
  • data-allow-local="true": send from localhost while testing (remove before shipping).
  • data-api: a custom batch endpoint (default https://in.metricmind.si/v1/batch), for a first-party proxy.

Requests from browsers driven by automation (navigator.webdriver) and known bots are never counted as visitors.

Events

Track the actions that matter to your business, in code or declaratively. Use snake_case, past-tense names, and never put personal data in properties.

window.mm?.track("signup_completed", { plan: "pro" })

<button data-track="listing_published" data-category="cars">Publish</button>

Every event can be a goal or a funnel step, and the analyst sees them. Calls made before the script loads are queued if you define window.mm = { q: [] } and push ["track", name, props].

Contacts and shares

Clicks on tel:, sms:, mailto:, WhatsApp (wa.me/<number>), Telegram and Messenger links are recorded as a contact event; WhatsApp links without a number and Facebook, X and LinkedIn share links as a share event. Only the channel is stored (phone, whatsapp, email…), never the number or address. The dashboard shows contacts, shares and the contact rate per traffic source.

Users

After sign-in, tell MetricMind who the visitor is. Their visits on every browser merge into one profile; traits stay out of the AI analyst’s reach.

window.mm?.identify("user_123", { email: "sam@example.com", plan: "pro" })
window.mm?.reset() // on sign-out

For checkout attribution, window.mm?.ids() returns the visitor, session and user IDs to pass as Stripe or Paddle metadata.

Feature flags

const { enabled, variant } = await window.mm.flag("new_checkout")

Flags are evaluated on our servers with stable bucketing per visitor (or user), and an exposure is recorded once per session, so the dashboard can show whether the flag moved your goals.

Opt-out

window.mm?.optOut() // stops collection on this browser
window.mm?.optIn()

To exclude your own team, open https://yoursite.com/?mm_optout=1 once in each browser (=0 resumes). Paths such as /admin or /preview/* can be excluded for everyone in Settings → General.

IP addresses are used once to look up the country and network and never stored. Query strings are removed from page paths and referrers.

AI crawlers

Crawlers that run JavaScript (Applebot, Googlebot) are recorded as reads automatically. Most AI crawlers (GPTBot, ClaudeBot, PerplexityBot) don’t run JavaScript; report them from your server with the site’s secret server key (AI agents page, admins only):

// middleware.ts (Next.js)
import { trackCrawler } from "@metricmind/agents";
export function middleware(request) {
  trackCrawler(request, { site: "YOUR_SITE_ID", key: process.env.METRICMIND_SERVER_KEY });
}

Query API

Create an API key with the Read analytics permission in Settings → API keys. Every number comes with the SQL that produced it.

curl https://api.metricmind.si/v1/metrics   # the catalog of metrics and filter fields

curl -X POST https://api.metricmind.si/v1/query \
  -H "Authorization: Bearer $METRICMIND_KEY" -H "Content-Type: application/json" \
  -d '{"site":"YOUR_SITE_ID","from":"2026-10-01","to":"2026-10-21","timezone":"Africa/Casablanca",
       "metrics":[{"name":"sources"},{"name":"top_pages","limit":20}],
       "filters":[{"field":"country","op":"eq","value":"MA"}]}'

curl https://api.metricmind.si/v1/realtime/YOUR_SITE_ID -H "Authorization: Bearer $METRICMIND_KEY"

Deploy markers

Post a note from your CI after each deploy (key with the Send events permission). It appears on the traffic chart and the analyst checks it when something changes.

curl -X POST https://api.metricmind.si/v1/annotations \
  -H "Authorization: Bearer $METRICMIND_KEY" -H "Content-Type: application/json" \
  -d '{"site":"YOUR_SITE_ID","text":"Deployed a1b2c3: new checkout"}'

MCP

Ask Claude, Cursor or any MCP client about your analytics. Tools: list_sites, list_metrics, get_data, get_realtime, get_insights, ask_analyst. All read-only.

claude mcp add --transport http metricmind https://api.metricmind.si/mcp \
  --header "Authorization: Bearer $METRICMIND_KEY"