メインコンテンツへスキップ
4分で読めます

GET /analytics/:websiteId

Retrieve a comprehensive analytics overview for a website. Returns total visitors, page views, unique visitors, and daily aggregated statistics for the specified time range.

GET/api/external/v1/analytics/:websiteId

Get analytics overview with daily breakdowns

Authentication

All requests require an API key passed via the X-API-Key header. Alternatively, you can use the Authorization: Bearer YOUR_API_KEY header.

AuthenticationBash
curl -X GET 'https://api.zenovay.com/api/external/v1/analytics/a1b2c3d4-e5f6-7890-abcd-ef1234567890?range=30d' \
-H 'X-API-Key: YOUR_API_KEY'

Parameters

NameTypeRequiredDefaultDescription
websiteIdstring (path)Yes-The UUID of the website
rangestring (query)No7dTime range: 24h, 7d, 30d, 90d, 1y

Response

Response (200 OK)JSON
{
"success": true,
"data": {
  "website": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "domain": "mywebsite.com",
    "name": "My Website"
  },
  "time_range": "30d",
  "date_range": {
    "start": "2026-01-08",
    "end": "2026-02-07",
    "startDateTime": "2026-01-08T12:00:00.000Z",
    "endDateTime": "2026-02-07T12:00:00.000Z"
  },
  "summary": {
    "total_visitors": 28450,
    "total_page_views": 94312,
    "unique_visitors": 18230
  },
  "daily_stats": [
    {
      "date": "2026-01-08",
      "website_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "total_visitors": 921,
      "unique_visitors": 612,
      "page_views": 3102
    },
    {
      "date": "2026-01-09",
      "website_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "total_visitors": 1043,
      "unique_visitors": 687,
      "page_views": 3451
    }
  ]
},
"timestamp": "2026-02-07T12:00:00.000Z"
}

Response Fields

FieldTypeDescription
website.idstringWebsite UUID
website.domainstringWebsite domain
website.namestringWebsite display name
time_rangestringThe requested time range
date_range.startstringStart date (YYYY-MM-DD)
date_range.endstringEnd date (YYYY-MM-DD)
date_range.startDateTimestringStart date as ISO 8601
date_range.endDateTimestringEnd date as ISO 8601
summary.total_visitorsnumberTotal visitor count
summary.total_page_viewsnumberTotal page view count
summary.unique_visitorsnumberUnique visitor count
daily_statsarrayArray of daily aggregated statistics

TypeScript Interface

AnalyticsOverviewResponseTypeScript
interface DailyStat {
date: string;
website_id: string;
total_visitors: number;
unique_visitors: number;
page_views: number;
}

interface AnalyticsOverviewResponse {
success: true;
data: {
  website: {
    id: string;
    domain: string;
    name: string;
  };
  time_range: string;
  date_range: {
    start: string;
    end: string;
    startDateTime: string;
    endDateTime: string;
  };
  summary: {
    total_visitors: number;
    total_page_views: number;
    unique_visitors: number;
  };
  daily_stats: DailyStat[];
};
timestamp: string;
}

HTTP Status Codes

Status CodeDescription
200Success
400Bad Request - Invalid parameters
401Unauthorized - Invalid or missing API key
403Forbidden - API key does not have access to this website
404Not Found - Website not found
429Too Many Requests - Rate limit exceeded
500Internal Server Error

Code Examples

cURLBash
curl -X GET 'https://api.zenovay.com/api/external/v1/analytics/a1b2c3d4-e5f6-7890-abcd-ef1234567890?range=30d' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json'

Error Handling

Error Response (404 Not Found)JSON
{
"success": false,
"error": {
  "message": "Website not found",
  "code": "NOT_FOUND",
  "timestamp": "2026-02-07T12:00:00.000Z"
}
}
このページは役に立ちましたか?