Списки минус-слов
    
    
      
    
    
      
      Оптимизируйте свои подборки
    
    
      
      Сохраняйте и классифицируйте контент в соответствии со своими настройками.
    
  
  
      
    
  
  
  
  
  
    
  
  
    
    
Получите список минус-слов по названию 
function getNegativeKeywordList(name) {
  const negativeKeywordLists = AdsApp.negativeKeywordLists()
      .withCondition(`shared_set.name = "${name}"`)
      .get();
  if (!negativeKeywordLists.hasNext()) {
    throw new Error(`Cannot find negative keyword list with name "${name}"`);
  }
  return negativeKeywordLists.next();
} Создайте новый список минус-слов и добавьте его в кампанию. 
function addNegativeKeywordListToCampaign(campaignName, negativeKeywordListName) {
  const negativeKeywordLists = AdsApp.negativeKeywordLists()
      .withCondition(`shared_set.name = "${negativeKeywordListName}"`)
      .get();
  if (!negativeKeywordLists.hasNext()) {
    throw new Error(`Cannot find negative keyword list with name "${negativeKeywordListName}"`);
  }
  const negativeKeywordList = negativeKeywordLists.next();
  const campaigns = AdsApp.campaigns()
      .withCondition(`campaign.name = "${campaignName}"`)
      .get();
  if (!campaigns.hasNext()) {
    throw new Error(`Cannot find campaign with the name "${campaignName}"`);
  }
  const campaign = campaigns.next();
  campaign.addNegativeKeywordList(negativeKeywordList);
} Удалите все общие минус-слова из списка минус-слов. 
function removeAllNegativeKeywordsFromList(name) {
  const negativeKeywordLists = AdsApp.negativeKeywordLists()
      .withCondition(`shared_set.name = "${name}"`)
      .get();
  if (!negativeKeywordLists.hasNext()) {
    throw new Error(`Cannot find negative keyword list with name "${name}"`);
  }
  const negativeKeywordList = negativeKeywordLists.next();
  for (const negativeKeyword of negativeKeywordList.negativeKeywords()) {
    negativeKeyword.remove();
  }
}
  
  
  
    
  
 
  
    
    
      
       
    
    
  
  
  Если не указано иное, контент на этой странице предоставляется по лицензии Creative Commons "С указанием авторства 4.0", а примеры кода – по лицензии Apache 2.0. Подробнее об этом написано в правилах сайта. Java – это зарегистрированный товарный знак корпорации Oracle и ее аффилированных лиц.
  Последнее обновление: 2025-08-21 UTC.
  
  
  
    
      [null,null,["Последнее обновление: 2025-08-21 UTC."],[],[]]