Google Adwords自动生成ExpandedTextAd

时间:2016-11-16 16:52:28

标签: ads google-adwords

我正在尝试更新我创建adGroup GoogleAdWords 上的脚本,然后生成关键字和expandedTextAd并将其插入此群组。问题在于脚本生成e xpandedTextAd。我得到一个错误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();

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.上的library(ggplot2) Example <- structure(list(Activity = c(0, 4, 7), LDT = structure(c(1456293600, 1456301700, 1456353300), class = c("POSIXct", "POSIXt"), tzone = "Canada/Eastern")), .Names = c("Activity", "LDT"), class = "data.frame", row.names = c(1L, 10L, 67L)) Time <- data.frame(xmin = as.POSIXct("20160224060000", format = "%Y%m%d%H%M%S", tz = "Canada/Eastern"), xmax = as.POSIXct("20160224120000", format = "%Y%m%d%H%M%S", tz = "Canada/Eastern")) ggplot(Example, aes(LDT, Activity)) + geom_point() + geom_rect(data = Time, aes(xmin = xmin, xmax = xmax, ymin = -Inf, ymax = Inf)) 而更新原因的原因 寻找你的帮助,因为我不知道该怎么做,花了6个多小时才找到解决方案,但没找到。

1 个答案:

答案 0 :(得分:0)

路径字段不得包含以下任何字符:/:;,。&lt;&gt;

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