skip to Main Content

I am trying to fetch reporting for the AdCampaign let’s say with xyz id, I have valid access token with ads_read, read_insights permissions & everything else except page_messaging. The app with the permitted token is owned by same ad account as well.

xyz/insights?fields=ad_name,....

No matter which fields I ask for, it always return me empty data set.

{
  "data": [
  ]
}

2

Answers


  1. For awhile I also struggled with this issue.

    What is probably going on is that no ads are being returned for the default parameters of the query. For example, by default Ad Insights looks at only the last 30 days of the advertisement’s lifetime. Try setting the ‘date_preset’ parameter to ‘lifetime’. For your query that would look like:

    xyz/insights?date_preset=lifetime&fields=ad_name,....
    

    For more info, check this page: https://developers.facebook.com/docs/marketing-api/reference/adgroup/insights/.

    Login or Signup to reply.
  2. @Dario-macieira is correct but now the date_preset = lifetime parameter is disabled in Graph API v10.0+ and replaced with date_preset = maximum, which returns a maximum of 37 months of data.

    For v9.0 and below, date_preset = maximum will be enabled on May 25, 2021, and any lifetime calls will default to maximum and return only 37 months of data.

    https://developers.facebook.com/docs/marketing-api/insights/parameters/v12.0

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search