Script to pause low performing ads

76 views
Skip to first unread message

Darius Price

unread,
Feb 16, 2021, 1:22:45 PM2/16/21
to Google Ads Scripts Forum
Hi All,

Does anyone know of a script that can pause all ads in an ad group keeping just the top 3 performing ads in the ad group based on impressions. 

This would be very useful as I am operating in an account with numerous campaigns and too many ad groups to try to do this manually.

Thanks in advance.

Google Ads Scripts Forum Advisor

unread,
Feb 16, 2021, 10:23:32 PM2/16/21
to adwords...@googlegroups.com

Hi Darius,

 

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

 

There is no currently available script that would match your requirement. If you are interested, I can provide guidance on how you can create a custom script in this regard. Here's a sample script that pauses ads in a specific ad group that you can take a look at in the meantime.

 

Let me know your thoughts.

 

Thanks,

Google Logo
Harry Cliford Rivera
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2CRaQZ:ref

Darius Price

unread,
Feb 18, 2021, 6:33:33 AM2/18/21
to Google Ads Scripts Forum on behalf of adsscriptsforumadvisor
Hi Harry,

Thanks for sending the script across, it would be great if you could provide some guidance on how to customize this script to the requirements needed.

Thanks

--
-- You received this message because you are subscribed to the Google Groups AdWords Scripts Forum group. Please do not reply to this email. To post to this group or unsubscribe please visit https://developers.google.com/adwords/scripts/community.
---
You received this message because you are subscribed to the Google Groups "Google Ads Scripts Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-scrip...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/Kn2Ew000000000000000000000000000000000000000000000QONLEV00B9JjstpxTzuBd0EoUhV1yQ%40sfdc.net.

Google Ads Scripts Forum Advisor

unread,
Feb 19, 2021, 12:28:47 AM2/19/21
to adwords...@googlegroups.com

Hi Darius,

 

Thanks for coming back. You may choose to do this by retrieving Ads at the AdGroup level or directly at the Ad entity level. I think we should implement your script with two function to achieve your requirement:

 

  • First is we have to identify the top three performing performing ads based on impressions:
  1. Create an AdSelector and AdIterator to iterate and retrieve entities at the Ad level.
    1. Use the orderBy(orderBy) in your selector to order ads by Impressions. (Eg. .orderBy("Impressions ASC") ).
    2. Make use of the withLimit(limit) method in your selector to only return the top three performing Ads.
    3. Finally, retrieve the Ads' IDs using the getId() method and use the JavaScript push method to collate them in an array.
  • Second part is to pause the ads referencing on the array of Ads' entity IDs:
  1. Create another AdSelector and AdIterator to iterate and retrieve entities at the Ad level.
    1. Retrieve Ad Ids using the getId() method and create a loop to compare them with the array of Ads' IDs.
    2. If the IDs comes out not equal, then pause the ad.

 

Let me know if you have questions or clarifications.

Reply all
Reply to author
Forward
0 new messages