2016-11-16 110 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編輯器中檢查似乎是錯誤的。