0

我编写了一个 adwords 脚本来暂停属于特定广告组的所有广告(带有特定标签)。

但是当我运行它时,出现错误“无法从 AdWords 读取。请稍候,然后重试。” 由于此行“.withCondition("LabelNames CONTAINS 'TEST'")”而发生此错误

当我删除这一行时,代码可以正常工作。

  var campaignsIterator = AdWordsApp.campaigns()
  .withCondition("Name CONTAINS 'SPECIFIC CAMPAIGN'")
  .get();

  if(!campaignsIterator.hasNext()){
    Logger.log("No Campaign");
  }else{

    while (campaignsIterator.hasNext()) {
      var campaign = campaignsIterator.next();

      var adGroupIterator = campaign.adGroups()
      .withCondition("Name CONTAINS 'SPECIFIC ADGROUP'")
      .get();

      while (adGroupIterator.hasNext()) {
        var adGroup = adGroupIterator.next();
        Logger.log("Campaign : " + campaign.getName() + " | AdGroup : " + adGroup.getName());

        var adIteratorNormal = adGroup.ads()
        .withCondition("LabelNames CONTAINS 'LABEL-TEST'") 
        .withCondition("Type = TEXT_AD")
        .get()

        while(adIteratorNormal.hasNext()){
          var ads = adIteratorNormal.next();

           if(ads.isEnabled()){
             ads.pause;
           }
        }
      } 
    }
  }

我想知道如何解决这个问题。谢谢帕斯卡

4

1 回答 1

1

解决问题:将“CONTAINS 'LABEL-TEST'”替换为“CONTAINS_ANY ['LABEL-TEST']”

https://groups.google.com/forum/#!topic/adwords-scripts/pqH0i1_YKDo

于 2013-07-20T14:47:58.207 回答