Google Adwords auto generating ExpandedTextAd

I'm trying to update my script on GoogleAdWords which creates adGroup , then generates keywords and expandedTextAd and inserts it into this group. The problem is where script generates an e xpandedTextAd . I alwas get an error There are illegal characters in the string. I have tried to remove protocol from links, remove spaces , use

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();           
  }
}

But if I use an old method of ad creation all works well.

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();

Reason to update it because of 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. on GoogleAdWordsDocs
Looking for you help, because I have no idea what to do, spent more then 6 hours to find the solution, but didn't find.


Path fields must not contain any of the following characters: /:;,.<>

Although it is not described in the official manual, it seems to be an error to check in AdWords Editor.

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

上一篇: 在AdWords中显示SFDC转化的问题

下一篇: Google Adwords自动生成ExpandedTextAd