Trying to delete labels from campaigns

235 views
Skip to first unread message

Felipe

unread,
Oct 29, 2015, 12:49:05 PM10/29/15
to AdWords Scripts Forum
Hello!

I am trying to write a script to delete all labels from campaigns with a specific label... can someone explain why the below isn't working?

function main() {
   var campaignIterator = AdWordsApp.campaigns()
       .withCondition("LabelNames CONTAINS 'Brand Event Label'")
       .get();
  if (campaignIterator.hasNext()) {
    var campaign = campaignIterator.next();
    campaign.removeLabel('Brand Event Label');
  }
}

I keep getting the error, even though I have pasted this from the example 'remove label from a campaign':
Invalid or inapplicable operator is used for field Labels. Please check the supported operators. (line 5)

Thanks!

Tyler Sidell (AdWords Scripts Team)

unread,
Oct 29, 2015, 2:53:41 PM10/29/15
to AdWords Scripts Forum
Hi Felipe,

If you change .withCondition("LabelNames CONTAINS 'Brand Event Label'") to .withCondition("LabelNames CONTAINS_ANY ['Brand Event Label']") it should work.  Let me know if that resolves your issue.

Thanks,
Tyler Sidell
AdWords Scripts Team

Felipe

unread,
Oct 30, 2015, 6:33:41 AM10/30/15
to AdWords Scripts Forum
worked like a charm. thank you!!
Reply all
Reply to author
Forward
0 new messages