How to get information about all the disapproved ad extensions?

90 views
Skip to first unread message

Krzysztof Bycina

unread,
Sep 30, 2022, 9:54:39 AM9/30/22
to Google Ads Scripts Forum
Hi Google Ads Scripts Team,

I'm trying to get information only about all disapproved ad extensions (type of extension and the campaign).

Currently, I have this:

function main() {
 
  let query = "SELECT feed_item.feed, feed_item.policy_infos, feed_item.status, segments.placeholder_type FROM feed_item";
  let rows = AdsApp.search(query);
 
  while (rows.hasNext()) {
    let row = rows.next();
    let extension = row.feed_item;
    console.log(row.feedItem.policyInfos)
  }
}

Can you help me filter out only disapproved ad extensions + the campaign name, please?


Thank you,
Krzysztof 

Sigurd Fabrin

unread,
Oct 3, 2022, 5:57:21 AM10/3/22
to Google Ads Scripts Forum
Hi Kryzstof,

Yeah, it's a bit tricky to do. As far as I can gather, it is actually not possible to do in the GAQL filter. 
However, you can always do the filtering with IF statements row-by-row afterwards.

Log row data like this, to see how the data is organised: console.log(JSON.stringify(row))

Something like this approach should get you started:
function main() {
  let query =
    'SELECT '+
      'feed_item.status, '+
      'feed_item.policy_infos, '+
      'campaign.name, '+
      'feed_item.id '+
    'FROM '+
      'feed_item '+
    'WHERE '+
      'feed_item.status = ENABLED';
  let rows = AdsApp.search(query);
  let data = [];
  let ids = [];

  while (rows.hasNext()) {
    let row = rows.next();
    let id = row.feedItem.id;
    if(ids.indexOf(id) != -1) {continue} // Check for duplicates
      ids.push(id); 
      let item = row.feedItem.policyInfos;
      if (
        item[0].approvalStatus != 'APPROVED' && // also include approved limited etc
        item[0].approvalStatus != 'UNKNOWN' &&
        item[0].reviewStatus == 'REVIEWED') {
        data.push('Campaign: '+row.campaign.name,'Type: '+item[0].placeholderTypeEnum,'ID: '+id,'Status: '+item[0].approvalStatus+'\n');
      }
  }
 console.log(data.join('\n'));
}

Sigurd

Google Ads Scripts Forum Advisor

unread,
Oct 4, 2022, 1:26:47 AM10/4/22
to adwords...@googlegroups.com

Hello Kryzstof,

James here, a member of the Google Ads scripts support team. Thank you for reaching out to us.

I confirm that the given solution by sigurd is correct. Also, there’s indeed currently no specific field that directly returns that approval status of a feed-based extension in feed_item resource type which you can use a filter with your GAQL query. Instead, you can only access it through feed_item.policy_infos. Having said that, can you please try to implement the given suggestion by Sigurd, then let me know how it goes on your end?

In any case that you will encounter a specific issue or error, kindly provide us with the following details below so that we can check this on our end.

  • Google Ads account ID / CID
  • Script name

@Sigurd - We greatly appreciate your efforts sharing your insights here.

Regards,

Google Logo
James Howell
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2ewTwo:ref
Reply all
Reply to author
Forward
0 new messages