GET /admin/hourStats  API documentation

Get the revenues reports by hour (requires TimeStats to be enabled, similar to the Days tab of the admin dashboard).

GET https://demo.trafficmanager.com/api/v1/admin/hourStats/{startTime}/{endTime}/

Authentication:

The request must be authenticated with the following HTTP headers:
  • x-api-key: Your API key, found in the Security page
  • x-user-id: Your User ID, found in the Security page
If the HTTP headers are not passed, but you are logged in to the TrafficManager panel, the current user is used instead (so you can easily preview or download the data using your browser)

GET Parameters:

  • Required:
  • startTime: Start time. Unix timestamp or any value accepted by strtotime. For example: 2023-01-01, today, -10 minutes...
  • endTime: End time. Unix timestamp or any value accepted by strtotime. For example: 2023-01-01 23:59:59, today 23:59:59, -5 minutes...
  • Optional:
  • user_id: affiliate ID filter (if set, returns only the data for that affiliate)
  • offer_id: offer ID filter (if set, returns only the data for that offer)
  • timezone: IANA timezone identifier (e.g., Europe/Bucharest). If invalid, defaults to UTC.

Returned values:

  • The response is a JSON object with data as an array where every row has the following values:
  • Date hour (e.g., 2021-08-01 14:00:00)
  • Number of impressions
  • Number of clicks
  • Number of unique clicks
  • Number of conversions
  • Conversion rate (%)
  • EPC (average payout per n clicks, calculated as: payout/clicks*n, where n is the EPC factor, currently 100)
  • Unique EPC (average payout per n unique clicks)
  • Total payout to the affiliate
  • Total revenues
  • Total profit (revenues - payout)

Request examples

With timezone UTC and affiliate + offer filters:

GET https://demo.trafficmanager.com/api/v1/admin/hourStats/2021-01-01%2000:00:00/2021-01-01%2023:59:59/?timezone=UTC&user_id=123&offer_id=456

With timezone Europe/Bucharest:

GET https://demo.trafficmanager.com/api/v1/admin/hourStats/2021-01-01%2000:00:00/2021-01-01%2023:59:59/?timezone=Europe/Bucharest

Response example

Response example:

{
    "data": [
        [
            "2021-08-01 14:00:00",
            120,
            60,
            40,
            3,
            5.0,
            0.5,
            0.75,
            30.0,
            42.0,
            12.0
        ],
        [
            "2021-08-01 15:00:00",
            90,
            50,
            30,
            1,
            2.0,
            0.4,
            0.6,
            20.0,
            22.0,
            2.0
        ]
    ],
    "timezone": "Europe/Bucharest",
    "status": 200
}