Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save siliconvallaeys/7237627acfe805d0d58aaab62249c93b to your computer and use it in GitHub Desktop.
Save siliconvallaeys/7237627acfe805d0d58aaab62249c93b to your computer and use it in GitHub Desktop.
// This simple script can be used in conjunction with Optmyzr's
// budget management scripts.
// uncomment either line 14 or 15 depending on whether you want to ADD or REMOVE the label
function main() {
var campaignIterator = AdsApp.campaigns().get();
Logger.log('Total campaigns found : ' +
campaignIterator.totalNumEntities());
while (campaignIterator.hasNext()) {
var campaign = campaignIterator.next();
var campaignName = campaign.getName();
Logger.log(campaignName);
campaign.applyLabel(campaignName); // <-- use this to add the label
//campaign.removeLabel(campaignName); // <-- use this to remove the label
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment