# Analytics

Read the daily spend, impressions, swipes, video views and purchases Zernio syncs from Snapchat Ads for an ad.

import { Tab, Tabs } from 'fumadocs-ui/components/tabs';


Zernio syncs spend, impressions, swipes, video views, video completion and purchases per ad and day from Snapchat's stats, and derives CTR, CPC and CPM from them. A swipe up counts as a click.

## Read ad analytics

Call `GET /v1/ads/{adId}/analytics` with the ad's `id` ([Get ad analytics](/ad-insights/get-ad-analytics)).

<Tabs items={['Node.js', 'Python', 'curl']}>
<Tab value="Node.js">
```typescript
const { data: insights } = await zernio.adinsights.getAdAnalytics({
  path: { adId: '6ae0968fa23091cc35b72188' },
  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="6ae0968fa23091cc35b72188",
    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/6ae0968fa23091cc35b72188/analytics?fromDate=2027-01-04&toDate=2027-01-11" \
  -H "Authorization: Bearer $ZERNIO_API_KEY"
```
</Tab>
</Tabs>

Response (`200`), trimmed:

```json
{
  "ad": { "id": "6ae0968fa23091cc35b72188", "name": "Spring drop", "platform": "snapchat", "status": "active", "currency": "USD" },
  "analytics": {
    "summary": { "spend": 96.4, "impressions": 38120, "clicks": 412, "ctr": 1.08, "cpc": 0.23, "cpm": 2.53 },
    "daily": [ { "date": "2027-01-04", "spend": 13.8, "impressions": 5440, "clicks": 58 } ]
  }
}
```

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

## How it behaves

- Snapchat reports spend in micro-currency; Zernio returns it in whole units of the ad account's currency.
- Days follow the ad account's time zone, and a new day appears after the next sync rather than in real time.
- Conversions are the purchases Snapchat attributed to the ad, with their value, from the Snap Pixel or the [Conversions API](/platforms/snapchat-ads/conversions).
- Video views and the 25, 50, 75 and 100% completion counts sync for video ads.
- An ad that never served, such as a paused one, returns an empty `daily` list.

## If it fails

| Error | Cause | Fix |
|-------|-------|-----|
| `404` | The `adId` is not a Zernio ad id | Use the `id` from `GET /v1/ads`, not the Snapchat ad id. |
| Empty `daily` | The ad had no impressions in the range | Widen the date range, or check the ad is running. |

## 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 squad.
- [Conversions API](/platforms/snapchat-ads/conversions): send server-side events to your Snap Pixel.