# Analytics

Read the daily spend, impressions, clicks, purchases and sales Zernio syncs from Amazon Ads reports, with ROAS and ACOS, per ad, ad group, campaign and keyword.

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

Zernio syncs spend, impressions, clicks, purchases and sales per day from Amazon's reports, at the campaign, ad group, ad and keyword levels, and derives CTR, CPC, ROAS and ACOS from them.

## 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: '6ae0968fa23091cc35b72199' },
  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="6ae0968fa23091cc35b72199",
    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/6ae0968fa23091cc35b72199/analytics?fromDate=2027-01-04&toDate=2027-01-11" \
  -H "Authorization: Bearer $ZERNIO_API_KEY"
```
</Tab>
</Tabs>

Response (`200`), trimmed:

```json
{
  "ad": { "id": "6ae0968fa23091cc35b72199", "name": "Trail bottle launch", "platform": "amazon", "status": "active", "currency": "USD" },
  "analytics": {
    "summary": { "spend": 84.2, "impressions": 15320, "clicks": 212, "conversions": 19, "purchaseValue": 531.4, "roas": 6.31, "ctr": 1.38, "cpc": 0.4 },
    "daily": [ { "date": "2027-01-04", "spend": 11.6, "impressions": 2010, "clicks": 29, "conversions": 3 } ]
  }
}
```

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

## Metrics

| Zernio metric | Amazon report column |
|---------------|----------------------|
| `spend` | `cost` |
| `impressions`, `clicks` | `impressions`, `clicks` |
| `conversions` | `purchases14d` on Sponsored Products, `purchases` on Sponsored Brands and Sponsored Display |
| `purchaseValue` | `sales14d` on Sponsored Products, `sales` on Sponsored Brands and Sponsored Display |
| `roas` | Sales divided by spend |
| ACOS | Not a field of the API: compute it as `1 / roas`. The dashboard shows it as a percentage |

## How it behaves

- Amazon builds its reports asynchronously, often over several minutes, so a new day appears after a later sync rather than in real time.
- Purchases count for 14 days after a click and Amazon restates them for weeks, so each sync rereads the last 42 days.
- `GET /v1/ads/insights` is live and does not cover Amazon: use the ad analytics, tree and performance endpoints.
- The reporting day is the marketplace's own time zone.
- An ad that never served 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 Amazon ad id. |
| Empty `daily` | The ad had no impressions in the range, or the report is still building | Widen the date range, or read it again after the next sync. |

## 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.
- [Keywords](/platforms/amazon-ads/keywords): metrics per keyword.