Misar IO Docs

Analytics

Retrieve views, revenue, and subscriber stats for your MisarBlog content.

Analytics

Get Analytics

GET /analytics

Returns aggregate stats for the authenticated creator's content.

Query Parameters

| Parameter | Type | Description | |-----------|------|-------------| | period | string | 7d | 30d | 90d | all (default: 30d) |

Response

200 OK

{
  "period": "30d",
  "views": {
    "total": 18420,
    "unique": 12304,
    "change_pct": 14.2
  },
  "revenue": {
    "total_usd": 284.50,
    "tips_usd": 34.50,
    "subscriptions_usd": 250.00
  },
  "subscribers": {
    "total": 1204,
    "new": 87,
    "churned": 12
  },
  "top_articles": [
    {
      "slug": "building-ai-apps-with-next-js",
      "title": "Building AI Apps with Next.js",
      "views": 4210,
      "read_pct": 68
    }
  ]
}

| Field | Description | |-------|-------------| | views.total | Total page views in the period | | views.unique | Unique visitor count | | views.change_pct | % change vs prior period | | revenue.total_usd | Combined tips + subscription revenue | | subscribers.total | Active paying subscribers | | top_articles | Top 5 articles by views, with read-completion % |

Example

curl "https://api.misar.io/blog/v1/analytics?period=7d" \
  -H "Authorization: Bearer mbk_YOUR_KEY"
const res = await fetch("https://api.misar.io/blog/v1/analytics?period=30d", {
  headers: { Authorization: `Bearer ${process.env.MISARBLOG_API_KEY}` },
});
const stats = await res.json();
console.log(stats.views.total);

Errors

| Status | Description | |--------|-------------| | 401 | Invalid or missing API key | | 400 | Invalid period value |