Docs/Analytics API

Analytics API

Access detailed analytics data programmatically for custom reporting and integrations.

Get Overview Metrics

GET/v1/analytics/overview
curl -X GET "https://api.chatmefy.com/v1/analytics/overview?period=30d" \
  -H "Authorization: Bearer YOUR_API_KEY"

# Response
{
  "data": {
    "period": {
      "start": "2024-01-01T00:00:00Z",
      "end": "2024-01-31T23:59:59Z"
    },
    "conversations": {
      "total": 12450,
      "completed": 10890,
      "handoff": 1560,
      "trend": "+12.5%"
    },
    "messages": {
      "total": 87240,
      "avg_per_conversation": 7.0,
      "trend": "+8.2%"
    },
    "leads": {
      "total": 3420,
      "qualified": 1890,
      "conversion_rate": 27.5,
      "trend": "+15.3%"
    },
    "satisfaction": {
      "score": 4.6,
      "responses": 2340,
      "trend": "+0.2"
    },
    "response_time": {
      "avg_ms": 1250,
      "p95_ms": 2800,
      "trend": "-5.1%"
    }
  }
}

Period Options

24h

Last 24 hours

7d

Last 7 days

30d

Last 30 days

90d

Last 90 days

Time Series Data

GET/v1/analytics/timeseries
curl -X GET "https://api.chatmefy.com/v1/analytics/timeseries?\
  metric=conversations&\
  period=7d&\
  granularity=day" \
  -H "Authorization: Bearer YOUR_API_KEY"

# Response
{
  "data": {
    "metric": "conversations",
    "granularity": "day",
    "points": [
      { "timestamp": "2024-01-08T00:00:00Z", "value": 412 },
      { "timestamp": "2024-01-09T00:00:00Z", "value": 458 },
      { "timestamp": "2024-01-10T00:00:00Z", "value": 389 },
      { "timestamp": "2024-01-11T00:00:00Z", "value": 521 },
      { "timestamp": "2024-01-12T00:00:00Z", "value": 445 },
      { "timestamp": "2024-01-13T00:00:00Z", "value": 312 },
      { "timestamp": "2024-01-14T00:00:00Z", "value": 287 }
    ]
  }
}

Available Metrics

conversationsTotal conversations started
messagesMessages exchanged
leadsLeads captured
handoffsHuman handoff requests
response_timeAverage response time (ms)
satisfactionSatisfaction score (1-5)

Breakdown by Dimension

GET/v1/analytics/breakdown
curl -X GET "https://api.chatmefy.com/v1/analytics/breakdown?\
  metric=leads&\
  dimension=source&\
  period=30d" \
  -H "Authorization: Bearer YOUR_API_KEY"

# Response
{
  "data": {
    "metric": "leads",
    "dimension": "source",
    "breakdown": [
      { "value": "/pricing", "count": 845, "percentage": 24.7 },
      { "value": "/features", "count": 612, "percentage": 17.9 },
      { "value": "/homepage", "count": 534, "percentage": 15.6 },
      { "value": "/demo", "count": 489, "percentage": 14.3 },
      { "value": "other", "count": 940, "percentage": 27.5 }
    ]
  }
}

Dimension Options

sourcePage URL where conversation started
botBot that handled the conversation
countryVisitor's country (ISO code)
deviceDevice type (desktop, mobile, tablet)
browserBrowser family (Chrome, Safari, etc.)
campaignUTM campaign parameter

Funnel Analysis

GET/v1/analytics/funnel
curl -X GET "https://api.chatmefy.com/v1/analytics/funnel?\
  steps=widget_opened,message_sent,lead_captured,demo_scheduled&\
  period=30d" \
  -H "Authorization: Bearer YOUR_API_KEY"

# Response
{
  "data": {
    "steps": [
      { "event": "widget_opened", "count": 15420, "rate": 100 },
      { "event": "message_sent", "count": 8934, "rate": 57.9 },
      { "event": "lead_captured", "count": 3420, "rate": 22.2 },
      { "event": "demo_scheduled", "count": 892, "rate": 5.8 }
    ],
    "overall_conversion": 5.8
  }
}

Export Data

Export analytics data in CSV format for external analysis:

POST/v1/analytics/export
curl -X POST "https://api.chatmefy.com/v1/analytics/export" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "conversations",
    "period": "30d",
    "format": "csv",
    "email": "team@company.com"
  }'

# Response
{
  "data": {
    "export_id": "exp_abc123",
    "status": "processing",
    "estimated_time": "2 minutes",
    "download_url": null
  }
}

Large exports are processed asynchronously. You'll receive an email with the download link.

Rate Limits

EndpointRate LimitNotes
GET /analytics/*100/minStandard analytics queries
POST /analytics/export10/hourExport requests
GET /analytics/realtime60/minReal-time data stream

Build Custom Dashboards