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

"Empty" label from a script

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi there.

I'm working on a script to automate some tasks: to get all my adgroups labeled every week according to data from an external spreedsheet.

I managed to get that part working just fine. 

But I still have to some tedious manual work before running the script: to remove all adgroups associated with each of the labels I'm using in the script, because if not, any of them may get more than one label, which would defeat the purpose of my script.

Could I do that programatically?

 

I tried iterating through all the adgroups and deleting the label(s), but they are just too many adgroups  so it times out

ie:

 

 function removeLabel() {
var adgroupIterator = AdWordsApp.adGroups().withCondition('Status = "ENABLED"').get();
while (adgroupIterator.hasNext()) {
var adgroup = adgroupIterator.next();
adgroup.removeLabel('example', 'of', 'different', 'labelnames');
}

 

 

TL;DR: Is there a way to remove some labels from all the adgroups it is applied without iterating through all adgroups?

 

 

1 Expert replyverified_user

"Empty" label from a script

Rising Star
# 2
Rising Star

If you are getting time-outs I would recommend using the Adwords API which is more powerful. Takes just a couple hours to setup and get your token, but should solve your problem. You would need to know a language other than JS though.

 

https://developers.google.com/adwords/api/docs/guides/start

Jim Vaillancourt, AdWords Rising Star, LinkedIn
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.