> Documentation index: https://docs.zernio.com/llms.txt. Every page is also Markdown: add .md to its URL.

# Analytics

Which analytics metrics Facebook returns for Page posts.

Call `GET /v1/analytics?platform=facebook` ([Analytics API](/analytics/get-analytics)).

| Metric | Available |
|--------|-----------|
| Impressions | <Yes /> |
| Likes | <Yes /> |
| Comments | <Yes /> |
| Shares | <Yes /> |
| Clicks | <Yes /> |
| Views | <Yes /> |

Meta's CDN links for post images and covers expire.

While a link is still valid the analytics response serves it as is, so download the image rather than storing the link.

Once it has lapsed, the response re-reads the media from Meta and serves `thumbnailUrl` and the `mediaItems` images from Zernio storage, which do not expire.

Until that re-read lands, or when Meta no longer returns the post, those fields are null rather than an expired link.

Video file URLs stay Meta's signed links and are refreshed on read once they lapse.

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
const { data: analytics } = await zernio.analytics.getAnalytics({
  query: { platform: 'facebook', fromDate: '2026-08-01', toDate: '2026-08-31' }
});

console.log(analytics.posts);
```
</Tab>
<Tab value="Python">
```python
analytics = client.analytics.get_analytics(
    platform="facebook",
    from_date="2026-08-01",
    to_date="2026-08-31"
)

print(analytics["posts"])
```
</Tab>
<Tab value="curl">
```bash
curl "https://zernio.com/api/v1/analytics?platform=facebook&fromDate=2026-08-01&toDate=2026-08-31" \
  -H "Authorization: Bearer $ZERNIO_API_KEY"
```
</Tab>
</Tabs>

Response (`200`), one entry per post:

```json
{
  "posts": [
    {
      "_id": "65f1c0a9e2b5af0012ab34cd",
      "platform": "facebook",
      "status": "published",
      "publishedAt": "2026-08-14T10:00:05Z",
      "platformPostUrl": "https://www.facebook.com/123456789012345/posts/987654321",
      "analytics": {
        "impressions": 15420,
        "likes": 342,
        "comments": 28,
        "shares": 45,
        "clicks": 189,
        "views": 0,
        "engagementRate": 2.78
      }
    }
  ]
}
```

Three Facebook-only endpoints go deeper:

- [Page insights](/analytics/get-facebook-page-insights): page-level aggregates (media views, reach, post engagements, reactions by type, video metrics, follower counts) over at most 89 days, defaulting to the last 30. The reach total is a sum of daily unique viewers, not unique people over the range, except an exactly 28-day range, which uses Meta's 28-day unique viewers when Meta returns them. Metric names follow the current Meta Graph API; the legacy `page_impressions`, `page_fans`, `page_fan_adds` and `page_fan_removes` metrics were deprecated by Meta on November 15, 2025 and are rejected. `followers_gained` and `followers_lost` come from Zernio's daily follower snapshotter.
- [Post reactions](/analytics/get-facebook-post-reactions): a count per reaction type for one post. The post analytics above report only the aggregate, as `likes`.
- [Post earnings](/analytics/get-facebook-post-earnings): lifetime monetization earnings for one post, read live from Meta. There is no date range, so never sum the totals across dates. A Page not enrolled in monetization returns `total: 0`.

**Reels retention.** A Reel's `analytics` also has `replays`, `retentionCurve` and watch time in milliseconds (`igReelsAvgWatchTime`, `igReelsVideoViewTotalTime`). `retentionCurve` maps whole seconds from the start of a play to the share still watching, 0 to 1.

- Loops count as continued playback, so a short Reel's curve runs past its length.
- Meta returns at most 41 points (keys `"0"` to `"40"`), so a long Reel shows only its first 40 seconds.
- The share is not of `views`: on small Reels the curve's base is far below `views`, and no metric Meta returns gives its size, so Zernio cannot return it.