Ярлыки аккаунта
    
    
      
    
    
      
      Оптимизируйте свои подборки
    
    
      
      Сохраняйте и классифицируйте контент в соответствии со своими настройками.
    
  
    
  
      
    
  
  
  
  
  
    
    
    
  
  
    
    
Создайте ярлык аккаунта 
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());
  }
} Выберите аккаунт по идентификатору ярлыка 
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.`);
  }
} Получение ярлыков учетных записей по их идентификаторам 
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());
  }
}
  
  
  
    
  
 
  
    
      
      
    
    
      
    
    
  
       
    
    
      
    
  
  
  Если не указано иное, контент на этой странице предоставляется по лицензии Creative Commons "С указанием авторства 4.0", а примеры кода – по лицензии Apache 2.0. Подробнее об этом написано в правилах сайта. Java – это зарегистрированный товарный знак корпорации Oracle и ее аффилированных лиц.
  Последнее обновление: 2025-08-21 UTC.
  
  
  
    
      [[["Прост для понимания","easyToUnderstand","thumb-up"],["Помог мне решить мою проблему","solvedMyProblem","thumb-up"],["Другое","otherUp","thumb-up"]],[["Отсутствует нужная мне информация","missingTheInformationINeed","thumb-down"],["Слишком сложен/слишком много шагов","tooComplicatedTooManySteps","thumb-down"],["Устарел","outOfDate","thumb-down"],["Проблема с переводом текста","translationIssue","thumb-down"],["Проблемы образцов/кода","samplesCodeIssue","thumb-down"],["Другое","otherDown","thumb-down"]],["Последнее обновление: 2025-08-21 UTC."],[],[]]