2016-11-16 108 views
0

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

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

理由来更新它,因为在GoogleAdWordsDocs
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.寻找你的帮助,因为我不知道该怎么做,花了那么6小时找到解决方案,但没有找到。

回答

0

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

虽然在官方手册中没有描述,但在AdWords编辑器中检查似乎是错误的。