계정 라벨을 만듭니다.
function createAccountLabels(labelName) {
  AdsManagerApp.createAccountLabel(labelName);
  console.log("Label with text = '%s' created.", labelName);
}
여러 계정에 계정 라벨을 적용합니다.
function applyAccountLabels(accountId1, accountId2, labelName) {
  // You can modify this function to accept an array of IDs directly as well.
  const accountIds = [accountId1, accountId2];
  const accounts = AdsManagerApp.accounts().withIds(accountIds).get();
  for (const account of accounts) {
    account.applyLabel(labelName);
    console.log('Label with text = "%s" applied to customer id %s.',
               labelName, account.getCustomerId());
  }
}
여러 계정에서 계정 라벨을 삭제합니다.
function removeLabelFromAccounts(accountId1, accountId2, labelName) {
  const accountIds = [accountId1, accountId2];
  var accounts = AdsManagerApp.accounts().withIds(accountIds).get();
  for (const account of accounts) {
    account.removeLabel(labelName);
    console.log('Label with text = "%s" removed from customer id %s.',
               labelName, account.getCustomerId());
  }
}
라벨 이름별로 계정을 선택합니다.
function selectAccountsByLabelName(labelName) {
  const accountIterator = AdsManagerApp.accounts()
      .withCondition(`LabelNames CONTAINS '${labelName}'`)
      .get();
  for (const account of accountIterator) {
    const accountName = account.getName() ? account.getName() : '--';
    console.log('%s,%s,%s,%s', account.getCustomerId(), accountName,
        account.getTimeZone(), account.getCurrencyCode());
  }
}
라벨 ID별로 계정을 선택합니다.
function selectAccountsByLabelId(labelId) {
  const label = AdsManagerApp.accountLabels().withIds([labelId]).get().next();
  const accountIterator = label.accounts().get();
  for (const account of accountIterator) {
    const accountName = account.getName() ? account.getName() : '--';
    console.log('%s,%s,%s,%s', account.getCustomerId(), accountName,
        account.getTimeZone(), account.getCurrencyCode());
  }
}
모든 계정 라벨을 검색합니다.
function getAllAccountLabels() {
  const labelIterator = AdsManagerApp.accountLabels().get();
  for (const label of labelIterator) {
    console.log('Label with id = %s and text = %s was found.',
               label.getId().toFixed(0), label.getName());
  }
}
계정 라벨을 이름으로 검색합니다.
function getLabelByName(labelName) {
  const labelIterator = AdsManagerApp.accountLabels()
      .withCondition(`label.name CONTAINS '${labelName}'`)
      .get();
  for (const label of labelIterator) {
    console.log(`Label with id = ${label.getId().toFixed(0)} ` +
        `and text = ${label.getName()} was found.`);
  }
}
계정 라벨을 ID로 검색합니다.
function getLabelById(labelId) {
  const labelIterator = AdsManagerApp.accountLabels()
      .withIds([labelId])
      .get();
  for (const label of labelIterator) {
    console.log("Label with id = %s and text = '%s' was found.",
               label.getId().toFixed(0), label.getName());
  }
}