What it does

Compare a metric between two periods. Volume metric — counts include AI-mediated human browsing (ai_user_action).

Example prompts

Ask:

"Compare last 7 days vs the previous 7 days for mysite.com."
"How does this month look compared to last month?"
"Pageviews trend week-over-week."

A typical response:

Pageviews, last 7 days vs previous 7 days:

  Period A (May 12-18):  42,180
  Period B (May 5-11):   31,420
  Change:                +34.2%
  Absolute delta:        +10,760

  Best day in A:  May 16 (8,114 views)
  Best day in B:  May 9  (5,847 views)

Returns a single object with both period values, the percentage and absolute delta, and bucket info if the period is sub-week granularity.

Period strings the parser understands:

  • last_7_days, last_30_days, last_90_days
  • previous_7_days, previous_30_days
  • this_week, last_week, this_month, last_month
  • last_24_hours, last_hour
  • YYYY-MM-DD..YYYY-MM-DD for explicit ranges

Volume metric: counts include AI-mediated human browsing. If you want to compare only direct browser traffic, you can filter using traffic_class_breakdown for each period instead.

Common workflow: pair with top_pages on both periods to identify pages driving the change.

Arguments

Name Type Required Description / Default
site_id string required Site identifier from list_sites (8-character base32, e.g. 'wjxayhdd').
metric string
enum: pageviews, visitors, sessions
required Metric to compare across periods. Volume metric, includes AI-mediated human browsing.
period_a string required First period (same format as `period` elsewhere). Returned as a_value.
period_b string required Second period to compare against (same format). Returned as b_value.

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": "compare_periods",
    "arguments": {
      "site_id": "abc12345",
      "metric": "pageviews",
      "period_a": "last_7_days",
      "period_b": "previous_7_days"
    }
  }
}'

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

Related tools

  • top_languages: Top browser languages (de-DE, en-US, ...) of visitors.
  • top_pages: Most-viewed URL paths.
  • get_account: Account info — email, current plan, total active sites, total_hits_this_month (across all sites), plan_limit, and api_token_first_chars (first 10 chars of the legacy API token, for identification only — not enough to authenticate).
  • top_user_agents: Top User-Agent strings with their traffic_class.
  • traffic_class_breakdown: Hit counts and percentages by traffic_class for the period.