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

# Analytics

Read spend, impressions, clicks, CTR, CPC and CPM for a Promoted Pin over a date range.

Read a Promoted Pin's spend and delivery metrics over a date range with `GET /v1/ads/{adId}/analytics`.

## Read ad analytics

Call `GET /v1/ads/{adId}/analytics` with the ad's `_id` for spend, impressions, clicks, CTR, CPC and CPM. Pinterest reports saves and closeups alongside those standard metrics.

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
const { data: insights } = await zernio.adinsights.getAdAnalytics({
  path: { adId: '66f0a1b2c3d4e5f6a7b8c9d0' },
  query: { fromDate: '2027-01-04', toDate: '2027-01-11' }
});

console.log(insights.analytics.summary.spend);
```
</Tab>
<Tab value="Python">
```python
insights = client.ad_insights.get_ad_analytics(
    ad_id="66f0a1b2c3d4e5f6a7b8c9d0",
    from_date="2027-01-04",
    to_date="2027-01-11",
)

print(insights["analytics"]["summary"]["spend"])
```
</Tab>
<Tab value="curl">
```bash
curl "https://zernio.com/api/v1/ads/66f0a1b2c3d4e5f6a7b8c9d0/analytics?fromDate=2027-01-04&toDate=2027-01-11" \
  -H "Authorization: Bearer $ZERNIO_API_KEY"
```
</Tab>
</Tabs>

Response (`200`), trimmed:

```json
{
  "ad": { "id": "66f0a1b2c3d4e5f6a7b8c9d0", "name": "Spring home decor", "platform": "pinterest", "status": "active", "currency": "USD" },
  "analytics": {
    "summary": { "spend": 186.5, "impressions": 74300, "clicks": 1240, "ctr": 1.67, "cpc": 0.15, "cpm": 2.51 },
    "daily": [ { "date": "2027-01-04", "spend": 27.9, "impressions": 10600, "clicks": 181 } ]
  }
}
```

`GET /v1/ads/tree` rolls the same metrics up per campaign and ad group ([Get campaign tree](/ad-campaigns/get-ad-tree)).

## How it behaves

- Pinterest reports `reach` as 0, because Zernio does not sync it.
- When the account connects, Zernio imports its last 90 days of metrics. `summary` and `daily` hold no data for days before that, because only Meta backfills an older range on request.
- The demographic `breakdowns` parameter is Meta and TikTok only.

## If it fails

| Error | Cause | Fix |
|-------|-------|-----|
| `reach` is 0 | Zernio does not sync reach from Pinterest | Use impressions, or read reach in Pinterest Ads Manager. |
| `400` | An invalid parameter | Read the message: it lists the offending value and the supported set. |
| `404` | The ad id is unknown | Use the ad's `_id` from the create or from `GET /v1/ads/tree`. |

## Related

- [Get ad analytics](/ad-insights/get-ad-analytics): metrics, date ranges and rollups.
- [Get campaign tree](/ad-campaigns/get-ad-tree): metrics per campaign and ad group.
- [Send a conversion event](/platforms/pinterest-ads/conversions): server-side events and their quality score.