Applying an account label not working?

164 views
Skip to first unread message

James Wilson

unread,
Mar 14, 2019, 5:41:30 AM3/14/19
to Google Ads Scripts Forum
Hi Everyone, 

I have an MCC level script which checks each sub-account and performs tasks on those. 

I want to apply a label to each account so when it runs again it knows which account it has worked with previously. 

Unfortunately whenever it applies the label to the account in the script logs I get "An error has occurred. Please try again later." 

You can replicate this with this script:

function main() {
  var accounts_checked = 1;
  var labelName = 'my_label';
  var number_of_accounts = 50;
  
  MccApp.createAccountLabel(labelName);

  var accountSelector = MccApp.accounts()
     .withCondition("Clicks > 1")
     .withCondition("LabelNames DOES_NOT_CONTAIN '"+labelName+"'")
     .forDateRange("TODAY")
     .orderBy("Cost DESC");
  
  var accountIterator = accountSelector.get();
  

  while (accountIterator.hasNext()) {
    var account = accountIterator.next();
    account.applyLabel(labelName);
  }
}


Anyone have any idea why this wouldn't work?

James

googleadsscrip...@google.com

unread,
Mar 14, 2019, 2:06:45 PM3/14/19
to James Wilson via Google Ads Scripts Forum, Google Ads Scripts Forum
Hi James,

Can you please try changing contexts to the client account using select before applying the label? For example,

  while (accountIterator.hasNext()) {
    
var account = accountIterator.next();

    
AdsManagerApp.select(account); //Change account context
    account
.applyLabel(labelName);
  
}


Regards,
Matt
Google Ads Scripts Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_scripts
    https://developers.google.com/google-ads/scripts/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--
-- 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-scripts+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/253dbb61-c13b-4ae4-a6c0-16395a26e81f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

James Wilson

unread,
Mar 15, 2019, 8:57:42 AM3/15/19
to Google Ads Scripts Forum
Hi Matt, 

Thanks for coming back to me, unfortunately this hasn't resolved the issue. 

What's more annoying is that in "preview" it shows no errors :(

James


On Thursday, March 14, 2019 at 6:06:45 PM UTC, googleadsscripts-forumadvisor wrote:
Hi James,

Can you please try changing contexts to the client account using select before applying the label? For example,

  while (accountIterator.hasNext()) {
    
var account = accountIterator.next();
    
AdsManagerApp.select(account); //Change account context
    account
.applyLabel(labelName);
  
}


Regards,
Matt
Google Ads Scripts Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_scripts
    https://developers.google.com/google-ads/scripts/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

googleadsscrip...@google.com

unread,
Mar 15, 2019, 2:56:12 PM3/15/19
to James Wilson via Google Ads Scripts Forum, Google Ads Scripts Forum
Hi James,

This may be related to an ongoing issue with account labels -- can you please provide your CID and script name so I can investigate the issue directly in your account?

Thanks,
Matt
Google Ads Scripts Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_scripts
    https://developers.google.com/google-ads/scripts/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

William Martret

unread,
Apr 15, 2019, 10:48:54 AM4/15/19
to Google Ads Scripts Forum
Hello James and Matt,

I'm having the same error.
It's a bug? Did you manage to work around the problem?

Many thanks,

William


Le vendredi 15 mars 2019 19:56:12 UTC+1, googleadsscripts-forumadvisor a écrit :
Hi James,

This may be related to an ongoing issue with account labels -- can you please provide your CID and script name so I can investigate the issue directly in your account?

Thanks,
Matt
Google Ads Scripts Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_scripts
    https://developers.google.com/google-ads/scripts/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

googleadsscrip...@google.com

unread,
Apr 15, 2019, 1:12:05 PM4/15/19
to William Martret via Google Ads Scripts Forum, Google Ads Scripts Forum
Hi William,

Can you please privately provide me with your script name and CID so I can see if the issue is related to ongoing work with account labels?

Thanks,
Matt
Google Ads Scripts Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:

wil...@keyade.com

unread,
May 3, 2019, 10:48:08 AM5/3/19
to Google Ads Scripts Forum
Hi Matt,

Any news on the ongoing issue ? 

Many thanks 

William


Le lundi 15 avril 2019 19:12:05 UTC+2, googleadsscripts-forumadvisor a écrit :
Hi William,

Can you please privately provide me with your script name and CID so I can see if the issue is related to ongoing work with account labels?

Thanks,
Matt
Google Ads Scripts Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_scripts
    https://developers.google.com/google-ads/scripts/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

googleadsscrip...@google.com

unread,
May 3, 2019, 3:30:40 PM5/3/19
to adwords-scripts+apn2wqe1myvorlrl...@googlegroups.com, Google Ads Scripts Forum
Hi William,

We have changed the way account labels work. When adding or filtering on account labels, everything is stored at the "Creator Customer ID" level now. That means that whatever manager account the authenticating user logged in as, that's the account whose labels will apply. If you drill down into another level of manager account, you will still be using labels from the parent manager account level. If you need to filter on labels, then you must set up the script to run in the same account that you first log into upon accessing Google Ads.

For your link checker script, can you please try copying your current script into a new script project, deleting the current link checker label, and then running the new copy?

Please let me know if the issue continues.

Thanks,
Matt
Google Ads Scripts Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_scripts
    https://developers.google.com/google-ads/scripts/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

William Martret

unread,
May 14, 2019, 3:37:58 PM5/14/19
to Google Ads Scripts Forum
Hi Matt,

I created a new script and delete the label used but it still doesn't work. :( 
I also took over the basic Google script but I have the same problem.

Many thanks,

William

Le vendredi 3 mai 2019 21:30:40 UTC+2, googleadsscripts-forumadvisor a écrit :
Hi William,

We have changed the way account labels work. When adding or filtering on account labels, everything is stored at the "Creator Customer ID" level now. That means that whatever manager account the authenticating user logged in as, that's the account whose labels will apply. If you drill down into another level of manager account, you will still be using labels from the parent manager account level. If you need to filter on labels, then you must set up the script to run in the same account that you first log into upon accessing Google Ads.

For your link checker script, can you please try copying your current script into a new script project, deleting the current link checker label, and then running the new copy?

Please let me know if the issue continues.

Thanks,
Matt
Google Ads Scripts Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_scripts
    https://developers.google.com/google-ads/scripts/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

googleadsscrip...@google.com

unread,
May 14, 2019, 4:40:10 PM5/14/19
to William Martret via Google Ads Scripts Forum, Google Ads Scripts Forum
Hi William,

Since you already provided your CID, can you just provide the script name so I can investigate?

Thanks,
Matt
Google Ads Scripts Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_scripts
    https://developers.google.com/google-ads/scripts/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Reply all
Reply to author
Forward
0 new messages