ThallerThanYall
ThallerThanYall

Reputation: 307

Adwords Scripting - Get Ad by Label

I'm trying to write a script in adwords to find out of stock items and pause ads accordingly. Obviously I don't want to run the query on every single Ad link as not all links are product pages of a website, so I've labelled all of the Ad URLs that I want to affect with a "Product" Label.

Only catch is that I can't seem to find a way of testing for the label on the ad. Anyone able to help?

Upvotes: 0

Views: 126

Answers (1)

fabrigm
fabrigm

Reputation: 658

You can select just the ads with that label like this:

 var adSelector = AdWordsApp
     .ads()
     .withCondition("LabelNames CONTAINS_ANY ['Product']");

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

Upvotes: 1

Related Questions