To access the external statistics you need POST method with the following parameters:
- access_token – secret key for API access. This parameter is optional and can be skipped if the API is open.
- ids – object identifications array for which the statistics are required. It can be a Campaign ID, an AdSet ID or a Creative ID.
- fields – fields array for which the statistics are required.
- date_preset - 'today', 'yesterday', 'this_week', 'last_week', 'last_7_days', 'last_14_days', 'last_28_days', 'last_30_days', 'last_90_days', 'this_month', 'last_month', 'this_quarter', 'last_3_months', 'last_hour' , prev_hour
- date_start – date of the beginning of the ad in "2015-12-24" format
- date_stop – date of the end of the ad in "2015-12-26" format
- time_increment – statistics period 'monthly', 'all_days' or an integer 1-90 days (1 day by default)
If you don’t specify date_start and date_stop the statistics will be displayed for the entire existence of the ad.
Examples:
#1. When sending ids=[123,432] fields=["field1","field2","field2"] date_start="2015-09-21", date_stop="2015-09-23" time_increment = 1
{ "123": { "data": [ { "date_start": "2015-09-21", "date_stop": "2015-09-21", "field1": 35, "field2": 0.5, "field3": 5 }, { "date_start": "2015-09-22", "date_stop": "2015-09-22", "field1": 53, "field2": 0.5, "field3": 3 }, { "date_start": "2015-09-23", "date_stop": "2015-09-23", "field1": 3, "field2": 0.9, "field3": 51 } ] }, "432": { "data": [ { "date_start": "2015-09-21", "date_stop": "2015-09-21", "field1": 35, "field2": 0.5, "field3": 5 }, { "date_start": "2015-09-22", "date_stop": "2015-09-22", "field1": 53, "field2": 0.5, "field3": 3 }, { "date_start": "2015-09-23", "date_stop": "2015-09-23", "field1": 3, "field2": 0.9, "field3": 51 } ] } }
#2. When sending ids=[123] fields=["field1","field2","field2"] date_start="2015-09-21", date_stop="2015-09-23" time_increment = "all_days"
{ "123": { "data": [ { "date_start": "2015-09-21", "date_stop": "2015-10-23", "field1": 35, "field2": 1.5, "field3": 78 } ] } }
If we specify neither date_start nor date_stop then we will get data for all the time for each ID, i.e. if the campaign 123 lasted from 2015-09-20 to 2015-09-25 and the campaign 432 lasted from 2015-08-20 to 2015-10-25 then we will see something like example #1, but the data will be displayed between the start and end date.
Comments
0 comments
Please sign in to leave a comment.