0

I am trying to get lifetime reach and frequency metrics for my users' accounts and am unable to formulate the correct request.

I have tried the following call:

act_1234/reportstats?data_columns=['account_id','reach','frequency']&time_increment=all_days 

but this just throws

{
  "error": {
    "type": "Exception", 
    "message": "You must specify one of time_ranges, time_interval or date_preset.", 
    "code": 1487533
  }
}

The only thing I can think of is to specify the time_ranges as {time_start:0,time_stop:1391385600} so that the request goes through, but that doesn't return the correct values.

Any ideas?

EDIT 1

I am playing around with specifying the time_interval based on the earliest campaign start time to the current date, not sure if there is a better way.

Jay Taggart
  • 137
  • 9

1 Answers1

0

It will work if you set time_interval and time_increment:

act_1234/reportstats?time_interval={"day_start":{"day":"01","month":"02","year":"2014"},"day_stop":{"day":"04","month":"02","year":"2014"}}&time_increment=all_days&data_columns=['account_id','reach','frequency']&format=json

In case you want to fetch long time range, the only way would be to use the async query.

For async, do a POST request to the same URL above, but with additional parameter: async=true

act_1234/reportstats?time_interval={"day_start":{"day":"01","month":"02","year":"2014"},"day_stop":{"day":"04","month":"02","year":"2014"}}&time_increment=all_days&data_columns=['account_id','reach','frequency']&format=json&async=true

You will get a report ID as a response to this request.

Then you have to make GET request with next parameters:

act_1234/reportstats?report_run_id=NUMBER_YOU_RECEIVED_PREVIOUSLY

And you will get a response with requested parameters, or you will get current progress of the report (in percentage, sometimes it can take a while to generate reports for long period).

  • I'm familiar with what you are saying; however, I am having trouble identifying the correct time range. What you have there will show only three days of data (2/1,2/2,2/3) and potentially miss data from before. I am wondering if there is a shortcut to defining "get all reach/frequency data for this account" – Jay Taggart Feb 04 '14 at 20:16
  • There is a limitation in ad reportstats, currently it says like this: API can't provide some data before certain dates: any data prior to September 28th 2012, actions prior to November 15th 2012, demographic data (gender, age) prior to Jan 1st 2013, placement data prior to April 24th 2013. Set September 28th 2012 as a start date, and you will certainly get all values for the campaigns you have. – Nikola Nikolic Feb 05 '14 at 15:44
  • This doesn't work either, it returned zeros for an account I know has data. – Jay Taggart Feb 05 '14 at 16:02