For the complete documentation index, see llms.txt. This page is also available as Markdown.

Quickstart

Three ways to send events: curl (or any HTTP client), the browser SDK, the Node SDK, or an AI agent via MCP. They all hit the same API.

1. Get an API key

In the dashboard, create a project. You'll get three keys:

Key
Use it from
What it can do

pk_live_…

browsers (origin-restricted)

ingest only

sk_live_…

servers, scripts, anywhere private

ingest only

rk_live_…

servers, MCP clients, dashboards

read only

Add your site's origin to the project's allowlist before using pk_* keys from a browser.

2. Send your first event

curl

curl -X POST https://api.millimetric.ai/v1/track \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "event": "signup",
    "anonymous_id": "u_abc",
    "user_id": "user_42",
    "url": "https://yoursite.com/?utm_source=facebook&utm_medium=cpc",
    "properties": { "plan": "free" }
  }'

Browser — snippet (any HTML page)

What you get automatically:

  • $pageview on load and every SPA route change

  • anonymous_id in localStorage (no cookies)

  • Captures utm_*, fbclid, gclid, ttclid, msclkid, li_fat_id, viewport, language, timezone

  • Respects DNT / Global Privacy Control

  • Batches events; flushes on pagehide via sendBeacon

Browser — npm (React / Next / Vue / Svelte)

Node / Bun

AI agent via MCP

Point any MCP-speaking agent at https://api.millimetric.ai/mcp with a Bearer token. Only server-side keys are accepted — pk_* is rejected because it's designed to ship in browser JS. Tools available:

  • track_event (requires an sk_* or admin key)

  • query_events, get_stats, top_sources (rk_*)

Example tool call:

3. Query your data

4. Privacy operations

How attribution is classified

Every event runs through a server-side classifier that turns raw utm_*, click IDs, and referrer into a clean (source, medium, confidence) tuple. The rules cascade, first match wins:

  1. gclid/msclkid/ttclid/li_fat_id ⇒ network / paid / high.

  2. fbclid arriving via l.facebook.com or lm.facebook.com ⇒ facebook / paid / high (Meta's ad-redirect hosts).

  3. fbclid + utm_source=facebook|instagram|meta ⇒ facebook|instagram / paid / high.

  4. utm_medium=cpc|paid|paid_social|cpm|display|retargeting ⇒ paid / high.

  5. fbclid alone, no other context ⇒ facebook / paid / medium (fbclid can leak onto organic shares but the dominant case is ad clicks).

  6. Explicit utm_source with no paid signal ⇒ source / utm_medium / high.

  7. Referrer ∈ Facebook hosts without fbclid ⇒ facebook / social / medium.

  8. Other known social referrers (twitter, linkedin, reddit, tiktok, youtube, pinterest, …) ⇒ source / social / medium.

  9. Search engines (google.*, bing, duckduckgo, …) ⇒ source / organic / medium.

  10. Email clients / ESPs ⇒ email / email / medium.

  11. Same-host referrer ⇒ internal / direct / high.

  12. No referrer & no UTM & no click ID ⇒ direct / direct / high.

  13. Otherwise ⇒ slug of referrer host / referral / low.

The matching rule's id is stored on every event so you can audit or re-classify later.

Last updated

Was this helpful?