(Beta) Ads & Keyword Selector Approval Status

122 views
Skip to first unread message

Stella Meyer

unread,
Aug 5, 2021, 9:14:21 AM8/5/21
to Google Ads Scripts Forum
Hi there, 

I am currently trying to migrate my scripts to the new Google Ads Beta, so you might get a few questions from me over the next weeks. 

Is there a way to use Approval Status as a selector for ads and keywords or do I need to get all the entities approval status to then work with them further. 

Until now, you could use Approval Status as a selector: 

function pausingAds() {

    var ad_iter = AdsApp.ads()

      .withCondition("Status = ENABLED")

      .withCondition("CombinedApprovalStatus = DISAPPROVED")

      .withCondition("CampaignStatus = PAUSED")

      .get();

...

}

or for keywords: 

function pausingKeywords() {

    var keyword_iter = AdWordsApp.keywords()

      .withCondition("Status = ENABLED")

      .withCondition("ApprovalStatus = DISAPPROVED")

      .withCondition("CampaignStatus = PAUSED")

      .get();

...

}

I see that we have the methods getPolicyApprovalStatus for ads and getApprovalStatus for keywords. But can it also be used as a selector? 

If I try 

function pausingAds() {

    var ad_iter = AdsApp.ads()
      .withCondition("ad_group_ad.status = ENABLED")
      .withCondition("CombinedApprovalStatus = DISAPPROVED")
      .withCondition("campaign.status = PAUSED")
      .get();
...
}

I'll get the following error: Exception: Call to GoogleAdsService.Search failed: = is not a valid operator to use with 'ad_group_ad.policy_summary' in WHERE clause.

Thank you in advance for your help. 

Best regards, 
Stella

Google Ads Scripts Forum Advisor

unread,
Aug 6, 2021, 2:19:34 AM8/6/21
to adwords...@googlegroups.com
Hi Stella,

Thanks for reaching out. Harry here, from the Google Ads Scripts Team.

For Ads, you would need to use the ad_group_ad.policy_summary.approval_status in your condition and the ad_group_criterion.approval_status that can be attributed for Keywords. Let me know if you have further questions on this.

Thanks,
Google Logo
Harry Cliford Rivera
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2Lkn1w:ref

Stella Meyer

unread,
Aug 6, 2021, 2:55:49 AM8/6/21
to Google Ads Scripts Forum
Thank you, Harry. Exactly what I was searching for!

Mariya Lebedeva

unread,
Jun 21, 2022, 1:39:23 PM6/21/22
to Google Ads Scripts Forum
Hi everyone!
I noticed the similar error: Call to GoogleAdsService.Search failed: Invalid enum value cannot be included in WHERE clause: 'ENABLE'.

I'm trying to use this code (I'd like to delete disapproved ads in my account):

function main() {

   var adSelector = AdsApp.ads().withCondition('CampaignStatus = ENABLED')

    .withCondition("ad_group_criterion.approval_status = ELIGIBLE")

    .withCondition('Status = ENABLED')

    .withCondition('ApprovalStatus = DISAPPROVED')

   var adIterator = adSelector.get();

   while (adIterator.hasNext()) {

       var ad = adIterator.next();

       Logger.log('Delete ads [' + ad.getId() + '] - "' + ad.getHeadline() + '"');

       ad.remove();

   }

}



Reply all
Reply to author
Forward
0 new messages