Trading Desk Stats API allows inquiring statistics by entities in general (advertisers, campaigns, etc.) or by metrics in particular (impressions, clicks, unique users, etc.).
To begin with, you need to get an access token. Using Postman or similar software, send a POST request by URL https://api.stacksandbox.com/api/token?userName=user&password=pass
Value | Description |
---|---|
userName | Your account login (email) |
password | Password to your account |
The field’s value is your access token. Specify it in the request header every time you inquire statistics the following way:
Authorization: Bearer your_token
where you replace your_token with your access token. For example:
Next, you get entity IDs.
You need an entity ID to request statistics.
Entity | Description |
---|---|
Advertiser | Defines a real advertiser in the Admixer system |
Campaign | Corresponds to one ad campaign |
Profile | Contains ad delivery settings, e.g. the budget, inventory, targeting, and bid details |
Ad Item | Contains main information about the creative, allows to set creative rotation priority and event tracking |
To retrieve entity IDs, send a GET request by a corresponding URL.
Entity | URL |
---|---|
Advertiser | https://api.stacksandbox.com/api/advertiser/list |
Campaign | https://api.stacksandbox.com/api/campaign/list |
Profile | https://api.stacksandbox.com/api/profile/list |
Ad Item | https://api.stacksandbox.com/api/ad-item/list |
Now that you have entity IDs, you can request information about them and their statistics.
You can retrieve information about a particular entity (name in the system, state, ad settings, etc.). Send GET request by a corresponding URL.
Entity | URL |
---|---|
Advertiser | https://api.stacksandbox.com/api/advertiser/advertiser_id |
Campaign | https://api.stacksandbox.com/api/campaign/campaign_id |
Profile | https://api.stacksandbox.com/api/profile/profile_id |
Ad Item | https://api.stacksandbox.com/api/ad-item/ad-item_id |
Replace advertiser_id, campaign_id, profile_id, ad Item_id with an advertiser ID, campaign ID, profile ID, or Ad Item ID respectively in your request URL.
You can retrieve statistics by each entity and particular metrics.
To receive statistics, specify entity ID or IDs and the period for which the data will be retrieved in the request URL.
Parameter | Description |
---|---|
ids | ID of an entity by which statistics is retrieved |
dateFrom | Start date of the period for which statistics is retrieved, according to account’s time zone. Date format yyyy-mm-dd |
dateTo | End date of the period for which statistics is retrieved, according to account’s time zone. Date format yyyy-mm-dd |
To retrieve statistics by an entity, send a GET request by the corresponding URL.
Entity | URL |
---|---|
Advertiser | https://api.stacksandbox.com/api/advertiser/stats?dateFrom=yyyy-mm-dd&dateTo=yyyy-mm-dd¤cyType=TradingDesk&TimeZoneType=TadingDesk |
Campaign | https://api.stacksandbox.com/api/campaign/stats?dateFrom=yyyy-mm-dd&dateTo=yyyy-mm-dd¤cyType=TradingDesk&TimeZoneType=TadingDesk |
Profile | https://api.stacksandbox.com/api/profile/stats?dateFrom=yyyy-mm-dd&dateTo=yyyy-mm-dd¤cyType=TradingDesk&TimeZoneType=TadingDesk |
Ad Item | https://api.stacksandbox.com/api/ad-item/stats?dateFrom=yyyy-mm-dd&dateTo=yyyy-mm-dd¤cyType=TradingDesk&TimeZoneType=TadingDesk |
Retrieve statistics by metrics within a profile or Ad Item.
To receive statistics by metrics within a profile, send a GET request by a corresponding URL.
Metrics | URL |
---|---|
Country/Region |
https://api.stacksandbox.com/api/profile/profile_id/stats/country?datefrom=yyyy-mm-dd&dateto=yyyy-mm-dd¤cyType=TradingDesk&TimeZoneType=TadingDesk https://api.stacksandbox.com/api/profile/profile_id/stats/region?datefrom=yyyy-mm-dd&dateto=yyyy-mm-dd¤cyType=TradingDesk&TimeZoneType=TadingDesk |
Domain | https://api.stacksandbox.com/api/profile/profile_id/stats/domain?datefrom=yyyy-mm-dd&dateto=yyyy-mm-dd¤cyType=TradingDesk&TimeZoneType=TadingDesk |
Device Type | https://api.stacksandbox.com/api/profile/profile_id/stats/device-type?datefrom=yyyy-mm-dd&dateto=yyyy-mm-dd¤cyType=TradingDesk&TimeZoneType=TadingDesk |
OS | https://api.stacksandbox.com/api/profile/profile_id/stats/os?datefrom=yyyy-mm-dd&dateto=yyyy-mm-dd¤cyType=TradingDesk&TimeZoneType=TadingDesk |
To receive statistics by metrics within an Ad Item, send a GET request by a corresponding URL.
Metrics | URL |
---|---|
Country/Region |
https://api.stacksandbox.com/api/ad-item/ad-item_id/stats/country?datefrom=yyyy-mm-dd&dateto=yyyy-mm-dd¤cyType=TradingDesk&TimeZoneType=TadingDesk https://api.stacksandbox.com/api/ad-item/ad-item_id/stats/region?datefrom=yyyy-mm-dd&dateto=yyyy-mm-dd¤cyType=TradingDesk&TimeZoneType=TadingDesk |
Domain | https://api.stacksandbox.com/api/ad-item/ad-item_id/stats/domain?datefrom=yyyy-mm-dd&dateto=yyyy-mm-dd¤cyType=TradingDesk&TimeZoneType=TadingDesk |
Device Type | https://api.stacksandbox.com/api/ad-item/ad-item_id/stats/device-type?datefrom=yyyy-mm-dd&dateto=yyyy-mm-dd¤cyType=TradingDesk&TimeZoneType=TadingDesk |
OS | https://api.stacksandbox.com/api/ad-item/ad-item_id/stats/os?datefrom=yyyy-mm-dd&dateto=yyyy-mm-dd¤cyType=TradingDesk&TimeZoneType=TadingDesk |