AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

2.8K members online now
2.8K members online now
Dive into advanced features like Remarketing, Flexible Bid Strategies, AdWords Editor, and AdWords Scripts
Guide Me

Automating Ads Rule/Script

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭


This post has been edited.

1 Expert replyverified_user

Re: Automating Ads Rule/Script

[ Edited ]
Top Contributor
# 2
Top Contributor

Hi Andrew,

If I understand this correctly, you have 2 adgroups for 2 different sets of ads but the same keywords and at any given point in time you need 1 set of ads to remain live and the other paused.

If this is correct and if I understand your requirement right, heres what I would do:
Keep only 1 set of keywords - having duplicate keywords in the account and pausing them frequently hampers the performance of the keyword & the account overall
have 2 sets of ads in the same adgroup and add labels to them ad X and Y. Then you can go on and pause the X ads and keep the Y ads live. and when you filter by Y ads and pause them, filter by X and make them live. This is a 2 step process.
To review performance then you can simply filter for the ad X & Y. You will also be able to identify when the ads were live by seeing the graph that gets generated on the top.

If you still want to follow you idea, I dont think it is possible through rules - ou can label your ads then then use scripts..
Here's a code that I just wrote out for you:

var adSelector ="LabelNames CONTAINS_ANY ['X']");

var adIterator = adSelector.get();
while (adIterator.hasNext()) {
var ad =;

var adSelectorY ="LabelNames CONTAINS_ANY ['Y']");
var adIteratorY = adSelectorY.get();
while (adIteratorY.hasNext()) {
var adY =;


AdWords Top Contributor
Did you find any helpful responses or answers to your query? If yes, please mark it as the ‘Accepted Solution’!