What it does

Top UTM source/medium/campaign combinations. Attribution metric — counts direct browser visits only ('user' class). AI-mediated traffic loses original UTM tags so it would only add noise. Counted once per session (field `sessions`), from the UTM tags the session entered on — not once per pageview, so don't compare it against pageview counts.

Example prompts

Ask:

"Which UTM source brought the most visits to mysite.com last month?"
"Top traffic sources by campaign, last 90 days."
"How did the spring_launch campaign actually perform?"

A typical response:

Top sources (last 30 days):

  newsletter    weekly       spring_launch    1,847 sessions
  twitter       social       (none)             612 sessions
  google        cpc          search_brand       487 sessions
  reddit        social       (none)             302 sessions
  google        cpc          search_generic     224 sessions
  podcast       referral     dev_tools_pod      174 sessions
  hackernews    referral     (none)             142 sessions
  newsletter    weekly       summer_promo       102 sessions
  (none)        organic      (none)              89 sessions

Returns groups of { utm_source, utm_medium, utm_campaign, sessions }. Counted once per session, from the source the session entered on — not once per pageview. Useful for evaluating whether a specific UTM-tagged campaign actually delivered, or for spotting that your newsletter is your highest-quality referral source.

Attribution metric: direct browser visits only. AI-mediated traffic loses original UTM tags entirely (an AI fetching a page doesn't preserve the user's original UTM-tagged click), so including it would add noise without signal. See traffic_class_breakdown for the per-class breakdown.

To see which channels drive conversions, not just visits, pass conversion_event (one of your custom events, e.g. signup): each row gains the share of its sessions (visitors, on sites in privacy mode all) that fired it during the period. For landing pages instead of channels, use top_entry_pages the same way. For built-in dimensions (browser, OS, device type), breakdown is the right tool.

Arguments

Name Type Required Description / Default
site_id string required Site identifier from list_sites (8-character base32, e.g. 'wjxayhdd').
period string optional Time window. Keywords: today, yesterday, last_7_days, last_30_days, last_90_days, last_12_months. Or a custom date range YYYY-MM-DD..YYYY-MM-DD (inclusive).
default: last_7_days
limit integer optional Maximum number of rows to return. Capped at 1000 server-side.
default: 10
conversion_event string optional Optional custom event name (case-sensitive, from list_events) to treat as the conversion. Each row then gains conversion_base (units in that row), converted (how many of them fired the event anywhere in the period) and conversion_rate (ratio 0–1: 0.05 means 5%; null when no unit is attributed to the row: it has no browser sessions/visitors at all, e.g. purely server-ingested traffic, or — on privacy_mode=all sites in top_referrers/top_sources/top_entry_pages — the row was never any visitor's first entry in the period, even though it has sessions). The response gains a site-wide `conversion` block: conversion_base (units in the period), converted (how many fired the event), conversion_rate (ratio 0–1: 0.05 means 5%), `unit` and a `note` to relay. Use it to compare conversion rates between rows — absolute counts alone favour whatever row has the most traffic. The unit depends on the site's privacy_mode: 'session' on strict and balanced sites (no identity survives UTC midnight there, so only conversions within one visit count), 'visitor' on privacy_mode=all sites (first-party cookie, so a visitor who arrives Monday and converts Thursday counts as converted, if both days are inside the period). The auto-tracked 'pageview' and 'engagement' are rejected — pick one of the site's own events.

How to call it directly

If you're integrating from your own code rather than a chat client, this is the JSON-RPC payload:

curl -X POST https://mcp-analytics.com/mcp \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "top_sources",
    "arguments": {
      "site_id": "abc12345"
    }
  }
}'

Token comes from /settings after you sign up. Replace any required arguments above.

Related tools

  • compare_periods: Compare a metric between two periods.
  • get_timeseries: Time-bucketed metric over a period.
  • breakdown: Breakdown of visits by browser, os, device_type, or country (country empty in MVP).
  • get_tracking_snippet: Return the HTML <script> snippet for a given site_id.
  • top_bots: Named-bot breakdown: which crawlers fetched the site, by canonical bot name (GPTBot, ClaudeBot, PerplexityBot, Googlebot, ...) with their traffic_class and hit counts.