Developers API
Analytics

Stats API Documentation

This documentation provides an overview of how to use the Stats API to retrieve campaign stats data. The API is designed to offer insights into campaign performance, allowing clients to make informed decisions based on real-time data.

Getting Started

To access the Stats API, clients must provide a valid token in the request header. This token is unique to each client and must match the publisher ID associated with the request.

Authentication

Each request to the Stats API must include the following headers for authentication:

  • Authorization: Bearer token provided to the client.

API Endpoint

The primary endpoint for retrieving Stats data is structured as follows:

GET /stats

Query Parameters

  • publisherId (required): The unique identifier for the publisher.
  • from (required): The start date for the data retrieval period (format: YYYY-MM-DD).
  • to (required): The end date for the data retrieval period (format: YYYY-MM-DD).
  • dimensions (optional): Comma separated list of stats break down. Currently country is supported.

Example Request

Below is an example of how to make a request to the Stats API using curl:

curl -X GET "https://api.otorotech.link/stats?publisherId=1000&startDate=2024-02-08&endDate=2024-02-10&dimensions=country" \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-H "Content-Type: application/json"

Response body

The API response will include detailed stats data for the specified period, including but not limited to impressions, clicks, conversions, and revenue. The data format will typically be JSON.

{
    "statusCode": 200,
    "data": [
        {
            "date": "2024-02-08",
            "channelId": "200",
            "countries": {
                "us": {
                    "totalSearches": 400,
                    "totalMonetizedSearches": 200,
                    "totalMonetizedClicks": 100,
                    "revenue": 39.63
                }
            }
        },
        {
            "date": "2024-02-09",
            "channelId": "200",
            "countries": {
                "us": {
                    "totalSearches": 74,
                    "totalMonetizedSearches": 58,
                    "totalMonetizedClicks": 42,
                    "revenue": 54.56
                }
            }
        },
        {
            "date": "2024-02-10",
            "channelId": "200",
            "countries": {
                "us": {
                    "totalSearches": 120,
                    "totalMonetizedSearches": 98,
                    "totalMonetizedClicks": 79,
                    "revenue": 84.12
                }
            }
        }
    ]
}