Web Analytics & AI Commerce

Access web analytics, manage MCP servers, track AI advertising campaigns, and monitor competitor visibility.

Web Analytics Report

Track website traffic from AI platforms (ChatGPT, Perplexity, Claude) and AI bot crawl activity (GPTBot, ClaudeBot, PerplexityBot). Understand how AI-driven discovery impacts your traffic and which pages AI bots are most interested in.

POST /v2/reports/web-analytics

Request Body Parameters

Parameter Type Description
start_date string Start date (YYYY-MM-DD)
end_date string End date (YYYY-MM-DD)
type string ai_traffic, bot_crawls, or all (default)
group_by string date, source, or page
domain string Filter by specific domain
limit / offset integer Pagination (max 1000)

Example: Traffic Over Time

curl -X POST \
     -H "X-API-Key: opttab_xxxxxxxxxxxxxxxxxxxx" \
     -H "Content-Type: application/json" \
     -d '{
       "start_date": "2026-01-01",
       "end_date": "2026-01-31",
       "type": "all",
       "group_by": "date"
     }' \
     "https://opttab.com/api/v2/reports/web-analytics"

Response

{
  "success": true,
  "data": [
    {
      "date": "2026-01-31",
      "total_events": 245,
      "ai_referrals": 180,
      "bot_crawls": 65
    },
    {
      "date": "2026-01-30",
      "total_events": 198,
      "ai_referrals": 142,
      "bot_crawls": 56
    }
  ],
  "meta": {
    "total_rows": 31,
    "group_by": "date",
    "type": "all"
  }
}

Example: Traffic by AI Source

curl -X POST \
     -H "X-API-Key: opttab_xxxxxxxxxxxxxxxxxxxx" \
     -H "Content-Type: application/json" \
     -d '{
       "start_date": "2026-01-01",
       "end_date": "2026-01-31",
       "type": "ai_traffic",
       "group_by": "source"
     }' \
     "https://opttab.com/api/v2/reports/web-analytics"

Response

{
  "success": true,
  "data": [
    { "source_name": "ChatGPT", "total_events": 520 },
    { "source_name": "Perplexity", "total_events": 380 },
    { "source_name": "Claude", "total_events": 210 },
    { "source_name": "Gemini", "total_events": 145 }
  ],
  "meta": {
    "total_rows": 4,
    "group_by": "source",
    "type": "ai_traffic"
  }
}

MCP Server Management

List and inspect your Model Context Protocol (MCP) servers. MCP servers allow AI models to interact with your data through standardized tools. Use these endpoints to monitor server activity and tool usage.

GET /v2/mcp/servers

List all your MCP servers.

Example

curl -H "X-API-Key: opttab_xxxxxxxxxxxxxxxxxxxx" \
     "https://opttab.com/api/v2/mcp/servers"

Response

{
  "success": true,
  "data": [
    {
      "id": 1,
      "slug": "my-ecommerce-server",
      "name": "E-Commerce Product Server",
      "description": "MCP server for product catalog access",
      "status": "active",
      "server_url": "https://opttab.com/api/mcp/my-ecommerce-server",
      "site_domain": "example.com",
      "total_requests": 1250,
      "total_tools": 5,
      "is_public": true,
      "last_request_at": "2026-02-09T10:30:00Z",
      "created_at": "2026-01-15T08:00:00Z"
    }
  ],
  "meta": { "total": 1 }
}
GET /v2/mcp/servers/{id}

Get detailed information about a specific MCP server, including its tools.

Example

curl -H "X-API-Key: opttab_xxxxxxxxxxxxxxxxxxxx" \
     "https://opttab.com/api/v2/mcp/servers/1"

Response

{
  "success": true,
  "data": {
    "id": 1,
    "slug": "my-ecommerce-server",
    "name": "E-Commerce Product Server",
    "description": "MCP server for product catalog access",
    "status": "active",
    "endpoint": "https://opttab.com/api/mcp/my-ecommerce-server",
    "total_requests": 1250,
    "is_public": true,
    "capabilities": ["tools"],
    "tools": [
      {
        "id": 1,
        "name": "search_products",
        "description": "Search product catalog by query",
        "input_schema": {
          "type": "object",
          "properties": {
            "query": { "type": "string" },
            "limit": { "type": "integer" }
          }
        },
        "is_active": true
      },
      {
        "id": 2,
        "name": "get_product_details",
        "description": "Get detailed info about a product",
        "input_schema": {
          "type": "object",
          "properties": {
            "product_id": { "type": "string" }
          }
        },
        "is_active": true
      }
    ]
  }
}

AI Commerce Campaigns

Access your AI advertisement campaigns. Track how your brand appears in AI-generated responses, measure impressions, clicks, conversions, and ROI across AI platforms.

GET /v2/commerce/campaigns

List all AI advertising campaigns with pagination.

Example

curl -H "X-API-Key: opttab_xxxxxxxxxxxxxxxxxxxx" \
     "https://opttab.com/api/v2/commerce/campaigns?per_page=20"

Response

{
  "success": true,
  "data": [
    {
      "id": 1,
      "name": "Q1 AI Visibility Campaign",
      "status": "active",
      "type": "standard",
      "budget": 5000.00,
      "spent": 2340.50,
      "impressions": 45000,
      "clicks": 1250,
      "conversions": 85,
      "start_date": "2026-01-01",
      "end_date": "2026-03-31",
      "created_at": "2025-12-20T10:00:00Z"
    }
  ],
  "meta": {
    "current_page": 1,
    "per_page": 20,
    "total": 3
  }
}
GET /v2/commerce/campaigns/{id}/metrics

Get detailed performance metrics for a specific campaign.

Example

curl -H "X-API-Key: opttab_xxxxxxxxxxxxxxxxxxxx" \
     "https://opttab.com/api/v2/commerce/campaigns/1/metrics"

Response

{
  "success": true,
  "data": {
    "campaign_id": 1,
    "name": "Q1 AI Visibility Campaign",
    "status": "active",
    "metrics": {
      "impressions": 45000,
      "clicks": 1250,
      "conversions": 85,
      "budget": 5000.00,
      "spent": 2340.50,
      "ctr": 2.78,
      "conversion_rate": 6.80,
      "cost_per_click": 1.87
    },
    "ai_models": ["chatgpt", "gemini", "claude"]
  }
}

Competitor Analysis

List competitors you're tracking to compare AI visibility and sentiment scores across brands.

GET /v2/commerce/competitors

List all tracked competitors with their visibility and sentiment scores.

Example

curl -H "X-API-Key: opttab_xxxxxxxxxxxxxxxxxxxx" \
     "https://opttab.com/api/v2/commerce/competitors"

Response

{
  "success": true,
  "data": [
    {
      "id": 1,
      "name": "Competitor A",
      "domain": "competitor-a.com",
      "visibility_score": 68.5,
      "sentiment_score": 62.1,
      "created_at": "2026-01-10T08:00:00Z"
    },
    {
      "id": 2,
      "name": "Competitor B",
      "domain": "competitor-b.com",
      "visibility_score": 55.3,
      "sentiment_score": 71.8,
      "created_at": "2026-01-10T08:00:00Z"
    }
  ],
  "meta": { "total": 2 }
}

Dashboard Summary

The dashboard summary endpoint provides a single-call overview of all key metrics. This is the recommended endpoint for partner integrations where you need to display an Opttab-powered overview in your own dashboard.

GET /v2/dashboard/summary

Query Parameters

Parameter Type Description
period string 7d, 30d (default), or 90d
tags[] array Filter by prompt tags (scope summary to specific categories)
sub_tags[] array Filter by prompt sub-tags

Example

curl -H "X-API-Key: opttab_xxxxxxxxxxxxxxxxxxxx" \
     "https://opttab.com/api/v2/dashboard/summary?period=30d"

Example: Scoped to a specific tag

curl -H "X-API-Key: opttab_xxxxxxxxxxxxxxxxxxxx" \
     "https://opttab.com/api/v2/dashboard/summary?period=30d&tags[]=brand_monitoring"

Response is cached for 5 minutes for performance. See the REST API Overview for the full response example.

Partner tip: Use the /v2/dashboard/summary endpoint for your initial integration. It returns visibility, sentiment, citations, and AI model breakdown in a single cached response — ideal for dashboard widgets and overview panels.

Error Codes

HTTP Code Error Code Description
401 UNAUTHORIZED Invalid or missing API key
403 FORBIDDEN Plan limit reached or insufficient permissions
404 NOT_FOUND Resource not found
422 VALIDATION_ERROR Invalid request parameters
429 RATE_LIMIT_EXCEEDED Too many requests
500 INTERNAL_ERROR Server error

Need Help?

For partner onboarding, custom integrations, or enterprise rate limits, contact our team.

Contact Support →