# Analytics

Read the spend, impressions and clicks Zernio syncs from AppLovin per campaign and creative set, with CTR, CPC and CPM.

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

With a Report Key on the account, Zernio syncs spend, impressions and clicks per creative set and day, and derives CTR, CPC and CPM from them.

## Before you start

The account needs a Report Key. Add it when you [connect](/platforms/applovin/connect#add-keys-later). The first sync runs within 15 minutes.

## Read ad analytics

Call `GET /v1/ads/{adId}/analytics` with the creative set'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": "Trail maps iOS", "platform": "applovin", "status": "active", "currency": "USD" },
  "analytics": {
    "summary": { "spend": 268.4, "impressions": 64100, "clicks": 1152, "ctr": 1.8, "cpc": 0.23, "cpm": 4.19 },
    "daily": [ { "date": "2027-01-04", "spend": 31.2, "impressions": 7420, "clicks": 138 } ]
  }
}
```

## Read spend per campaign

`GET /v1/ads/campaigns` with the account's `accountId` and a date range sums each campaign's `spend`, `impressions` and `clicks` over the range. `GET /v1/ads/tree` rolls them up per campaign and creative set ([Get campaign tree](/ad-campaigns/get-ad-tree)).

AppLovin campaigns also appear in [campaign results](/ad-campaign-results/list-campaign-results), next to the conversions they brought in.

A conversion counts for a campaign when it carries the value of the `{CAMPAIGN_ID}` macro, for example as `campaign.id` on [`POST /v1/events`](/conversions/send-events).

## How it behaves

- Zernio reads the last 7 days, today included, every 6 hours, so recent days update as AppLovin revises them.
- Dates are in UTC, and spend is in US dollars. Today's spend grows during the day.
- The first sync brings in the last 7 days. Older spend is not backfilled.
- An app campaign can read 0 impressions: AppLovin's app report has no impressions, so Zernio takes them from the web report when it lists the campaign.
- Without the Campaign Management API key, spend still syncs per campaign, from the report alone.

## If it fails

| Error | Cause | Fix |
|-------|-------|-----|
| No AppLovin campaigns listed | The account has no Report Key, or the first sync has not run yet | Add the Report Key, then wait up to 15 minutes. |
| Spend stopped updating | AppLovin refused the Report Key or the Campaign Management API key, so the sync waits before trying again | Connect again with fresh keys. |
| `404` | The `adId` is not a Zernio ad id | Use the `id` from `GET /v1/ads`, not the creative set's hashed id. |

## Related

- [Get ad analytics](/ad-insights/get-ad-analytics): metrics, date ranges and rollups.
- [List campaigns](/ad-campaigns/list-ad-campaigns): spend per campaign.
- [List campaign results](/ad-campaign-results/list-campaign-results): spend next to conversions.
- [Conversions](/platforms/applovin/conversions)