Read-only analytics queries against Millimetric. Uses an rk_live_… key (read scope). The headline feature is /v1/sources — it's the endpoint that surfaces Facebook social vs Facebook paid as separate rows.
millimetric-trackmillimetric-mcp-setup (MCP is usually nicer for AI)export MILLIMETRIC_RK=rk_live_... # read-only key
export MILLIMETRIC_HOST=https://api.millimetric.ai
curl -sG "$MILLIMETRIC_HOST/v1/sources" \
-H "Authorization: Bearer $MILLIMETRIC_RK" \
--data-urlencode "from=2026-05-01T00:00:00Z" \
--data-urlencode "to=2026-06-01T00:00:00Z" \
--data-urlencode "breakdown=source_medium" | jq
Returns rows like:
{ "source": "facebook", "medium": "paid", "events": 6, "uniques": 6, "paid_share": 1.0 }
{ "source": "facebook", "medium": "social", "events": 3, "uniques": 3, "paid_share": 0.0 }
For "what % of each source is paid", use breakdown=source — paid_share becomes meaningful (0.0 → 1.0).
# Daily signups grouped by source/medium
curl -sG "$MILLIMETRIC_HOST/v1/stats" \
-H "Authorization: Bearer $MILLIMETRIC_RK" \
--data-urlencode "metric=count" \
--data-urlencode "from=2026-05-01T00:00:00Z" \
--data-urlencode "to=2026-05-17T00:00:00Z" \
--data-urlencode "event=signup" \
--data-urlencode "group_by=source,medium" \
--data-urlencode "interval=day" | jq
Parameters:
| Param | Values |
|---|---|
| ------- | -------- |
metric | count, uniques |
from / to | ISO 8601 (inclusive / exclusive) |
event | optional event name filter |
group_by | comma list — any of source, medium, campaign, country, device_type, browser, os, path, event_name |
interval | hour, day, week, month (omit for a single bucket) |
curl -sG "$MILLIMETRIC_HOST/v1/query" \
-H "Authorization: Bearer $MILLIMETRIC_RK" \
--data-urlencode "from=2026-05-01T00:00:00Z" \
--data-urlencode "to=2026-05-17T00:00:00Z" \
--data-urlencode "event=signup" \
--data-urlencode "limit=100" | jq
Filters: event, source, medium, country, user_id, anonymous_id, limit (1–1000).
curl -sG "$MILLIMETRIC_HOST/v1/sources" \
-H "Authorization: Bearer $MILLIMETRIC_RK" \
--data-urlencode "from=$(date -u -v1d +%Y-%m-%dT00:00:00Z)" \
--data-urlencode "to=$(date -u +%Y-%m-%dT00:00:00Z)" \
| jq '.rows[] | select(.source=="facebook")'
curl -sG "$MILLIMETRIC_HOST/v1/stats" \
-H "Authorization: Bearer $MILLIMETRIC_RK" \
--data-urlencode "metric=uniques" \
--data-urlencode "event=signup" \
--data-urlencode "from=$(date -u -v-7d +%Y-%m-%dT00:00:00Z)" \
--data-urlencode "to=$(date -u +%Y-%m-%dT00:00:00Z)" \
--data-urlencode "group_by=country" \
--data-urlencode "interval=day" | jq
curl -sG "$MILLIMETRIC_HOST/v1/query" \
-H "Authorization: Bearer $MILLIMETRIC_RK" \
--data-urlencode "user_id=user_42" \
--data-urlencode "from=$(date -u -v-7d +%Y-%m-%dT00:00:00Z)" \
--data-urlencode "to=$(date -u +%Y-%m-%dT00:00:00Z)" \
--data-urlencode "limit=200" \
| jq '.rows[] | { ts: .timestamp, event: .event_name, source: .source, medium: .medium }'
Every event has source / medium / source_confidence / source_rule_id set by the server-side classifier. The rule cascade (first-match):
gclid, msclkid, ttclid, li_fat_id) → paid / highfbclid via l.facebook.com / lm.facebook.com → facebook/paid / highfbclid + utm_source=facebook|instagram|meta → paid / highutm_medium=cpc|paid|paid_social|cpm|display → paid / highfbclid alone → facebook/paid / mediumfbclid → facebook/social / mediumsource_rule_id lets you audit which rule matched.
| Status | error | Fix |
|---|---|---|
| -------- | --------- | ----- |
| 401 | invalid_api_key | Wrong key; must be rk_*. |
| 403 | insufficient_scope | Used pk_/sk_ — read endpoints want rk_*. |
| 400 | invalid_group_by | Unknown column in group_by. |
| 400 | invalid_params | Bad ISO dates or out-of-range limit. |
millimetric-trackmillimetric-mcp-setup共 1 个版本