Google Adwords自动生成ExpandedTextAd

我试图在创建adGroup GoogleAdWords上更新我的脚本,然后生成关键字和expandedTextAd并将其插入到该组中。 问题是脚本生成e xpandedTextAd 。 我alwas得到一个错误There are illegal characters in the string. 我试图从链接中删除协议,删除空格,使用

function addExpandedTextAds(adGroupName,i ,data) {


  var adGroupIterator = AdWordsApp.adGroups()
      .withCondition('Name = ' + adGroupName)
      .get();
  if (adGroupIterator.hasNext()) {
    var adGroup = adGroupIterator.next();    

    if (data[i].originCity.length < 11){
    var originCity = data[i].originCity;
  }
  else
  {
    var originCity = data[i].originIATA;
  }

  var finalUrl = data[i].finalUrl;

    adGroup.newAd().expandedTextAdBuilder()
      .withHeadlinePart1('Book Jets from '+ data[i].originIATA)
  .withHeadlinePart2('Book it now on')
      .withDescription('Get instant fixed prices from ' + data[i].originIATA)
  .withFinalUrl(finalUrl)
      .withPath1('url.com/' + data[i].originIATA)
      .build();           
  }
}

但是,如果我使用旧的ad创作方法,那么一切运作良好。

adGroup.newTextAdBuilder()
      .withHeadline('Private Jet from '+ data[i].originIATA )
  .withDescription1('Hire jet in ' + data[i].originIATA + ' for up to ' + data[i].pax + ' people')
  .withDescription2('Fixed-price booking from ' + data[i].flightSalePrice)
      .withDisplayUrl('https://www.url.com/' + data[i].originIATA )
      .withFinalUrl(data[i].finalUrl)
      .build();

更新原因是因为Note: Creation of text ads using AdGroup.newTextAdBuilder() is deprecated, and will no longer be supported after January 31, 2017. Existing text ads may be retrieved and will continue to serve as usual into 2017.年。 GoogleAdWordsDocs
寻找你的帮助,因为我不知道该怎么做,花了超过6小时找到解决方案,但没有找到。


路径字段不得包含以下任何字符:/:;,。<>

尽管在官方手册中没有描述,但在AdWords编辑器中签入似乎是错误的。

链接地址: http://www.djcxy.com/p/32377.html

上一篇: Google Adwords auto generating ExpandedTextAd

下一篇: is adsense allowed on social networking websites