Fetching Ad Reports through API

Using Adsense Management API through Pley.

📘

API Reference Documentation

See the generate-ads-report HTTP API here

You must also Authorization header with with the API Token found in the game manager. Read more here.

How to fetch Ads reports through API:

  1. Get your game ID from the Game Manager (Project > Project Settings > Game ID)
  2. Get body parameters (game_id, metrics, dimensions, start_date, end_date)
  3. Call generate-ads-report (HTTP API documentation)
  4. Receive the report in CSV!

The date range (start_date to end_date) is inclusive and has a maximum allowed range of 90 days.

Generate-ads-report is based on Adsense Management API for CSV Reports and uses USD as their revenue currency. Look at Google Adsense's documentation for specifics of what metrics and dimensions can be called!


API Call Example

curl --request POST \
     --url https://api.pley.com/v3/ads-kit/generate-report \
     --header 'accept: application/csv' \
     --header 'content-type: application/json' \
     --data '
{
  "start_date": "2024-01-01",
  "end_date": "2024-09-09",
  "metrics": [
    "TOTAL_IMPRESSIONS",
    "TOTAL_EARNINGS",
  ],
  "dimensions": [
    "COUNTRY_CODE"
  ]
  "game_id": "1234123412341234"
}
'

COUNTRY_CODE,TOTAL_IMPRESSIONS,TOTAL_EARNINGS
SE,1000,21
US,50000,132
DE,42000,86