0

What is the best and most optimal way to check the list of given ad_groups (list of ad_group ids) for disapprove status and to get the reasons of disapprovements?

The most straight-forward but not optimal way is to:

1) Get all disapproved ad_groups of the account:

params = {
    'status': ['DISAPPROVED'],
    'limit': 1000
}
adgroup_iter = account.get_ad_groups(params=params)
disapproved_ad_ids = []
for adgroup in adgroup_iter:
    disapproved_ad_ids.append(adgroup._data['id'])

2) From resulting list select only the ad_groups of interest by intersecting lists:

ads_of_interest = list(set(ad_ids_to_check) & set(disapproved_ad_ids))

3) Make a request FOR EACH ad_group of interest for it's disapprovement reasons (adgroup_review_feedback field):

for adgroup_id in ads_of_interest:
    adgroup = AdGroup(adgroup_id)
    print adgroup.remote_read(fields=[AdGroup.Field.adgroup_review_feedback])

The bad thing that I have a lot of ads running and it's not good to make a separate API call to get disapprovement reason for each of them because it just makes me to exceed the facebook requests limit.

ENDED UP WITH THE SOLUTION:

params = {
    'adgroup_status': ['DISAPPROVED'],
    'limit': 500,
    'fields': 'id,adgroup_review_feedback'
}

and then looking up for the intersections of results and the list of 'interesting' ads discarding the 3rd paragraph of my question because the needed data already is contained in results from 1st (thanks for @Igy answer)

Mention the 'adgroup_status' field name instead of 'status' (as given in my question) - this solved the problem of the wrong facebook responses. Probably it is the typo in documentation in "Fetching all ads of ad ad account..." example for Python SDK as it's not working in SDK v.2.2.6

1 Answers1

1

There's no need to fetching each ad individually

You can request the adgroup_review_feedback field along with the other fields you're interested in when fetching the list initially

Here's an example from my own account, IDs removed:

/v2.2/act_<ACCOUNT_ID>/adgroups
  ?adgroup_status=['DISAPPROVED']
  &fields=id,adgroup_review_feedback

Response:

{
  "data": [
    {
      "id": "<REMOVED>", 
      "adgroup_review_feedback": {
        "TEXT_OVERLAY": "Your ad wasn't approved because it uses too much text in its image or video thumbnail, which doesn't follow Facebook's ad guidelines. Ad images or video thumbnails aren't allowed to include more than 20% text. You'll still be charged for any impressions or clicks your ad received before it was disapproved. You may upload your ad image to see why it is considered 20% text, or visit the Help Center to learn more.If you’ve read the guidelines in the Help Center and think your ad follows the rules and should have been approved, please let us know."
      }
    }, 
    {
      "id": "<REMOVED>", 
      "adgroup_review_feedback": {
        "TEXT_OVERLAY": "Your ad wasn't approved because it uses too much text in its image or video thumbnail, which doesn't follow Facebook's ad guidelines. Ad images or video thumbnails aren't allowed to include more than 20% text. You'll still be charged for any impressions or clicks your ad received before it was disapproved. You may upload your ad image to see why it is considered 20% text, or visit the Help Center to learn more.If you’ve read the guidelines in the Help Center and think your ad follows the rules and should have been approved, please let us know."
      }
    }
  ], 
  "paging": {
    "cursors": {
      "before": "<REMOVED>==", 
      "after": "<REMOVED>=="
    }
  }
}

Using your code from the question as an example, this looks like it'll print out the disapproval reasons for all of the disapproved ads - strongly recommend not using 1000 as a limit on the first fetch though as you may start to see timeouts as the account gets many ads added to it over time

params = {
    'status': ['DISAPPROVED'],
    'limit': 1000,
    'fields': 'id,adgroup_review_feedback'
}

adgroup_iter = account.get_ad_groups(params=params)
for adgroup in adgroup_iter:
    print adgroup(adgroup_review_feedback)
Igy
  • 43,710
  • 8
  • 89
  • 115
  • Thanks! That is really helpful. Could not find in API reference how to request the additional data when calling /v2.2/act_/adgroups Also, in the last line you wrote: `print adgroup(adgroup_review_feedback)` Did you mean `print adgroup._data['adgroup_review_feedback']` instead or is there a better way to fetch the data from adgroup object? – Nikita Mendelbaum Mar 04 '15 at 04:38
  • As for limit for 1000 items - documentation says it's ok (https://developers.facebook.com/docs/marketing-api/adgroup/v2.2#read-adaccount) For now I have 460 ads in the response and it returns before you could say Miley Cyrus – Nikita Mendelbaum Mar 04 '15 at 04:54
  • And there's one more question: what are the adgroups returned with the mine and yours code which have no adgroup_review_feedback at all? So this adgroups are disapproved with no reason provided... – Nikita Mendelbaum Mar 04 '15 at 05:00
  • And sorry: is there a way to filter the results of the request by adgroup_ids to get only the ad_groups I am interested in instead of all disapproved for all time? – Nikita Mendelbaum Mar 04 '15 at 05:11
  • My sample for how to make your call may be incorrect but the API call i provided above that definitely works. Not all disapproved ads will have feedback available regarding why they were disapproved BTW, so you may see some disapproved ads with no feedback, especially older ads. Any request you make which requests ads can request the adgroup_review_feedback field as part of that request - if you're making one call to get a list of 'interesting' ads and another to see their status, you can likely add adgroup_review_feedback to the fields you're requesting in the first call and skip the second – Igy Mar 04 '15 at 23:33
  • For more info on selecting which fields to return, see here: https://developers.facebook.com/docs/graph-api/using-graph-api/ – Igy Mar 04 '15 at 23:34