add date to ad text adwords in script

43 views
Skip to first unread message

Omry Lieber

unread,
Dec 3, 2015, 9:09:35 AM12/3/15
to AdWords API Forum

I want to create ad that change the date every day. this is the script that I am running every day at 00:00:

var date_format = Utilities.formatDate(new Date(), "GMT", "dd/MM/y")
var AD_GROUP_NAME = 'ארונות הזזה';
function main() {
  var adGroup = getAdGroup(AD_GROUP_NAME);
  var keywords = adGroup.keywords().get();
  while (keywords.hasNext()) {
    var keyword = keywords.next();
    keyword.setAdParam(1, date_format);
  }
}
function getAdGroup(name) {
  var adGroupIterator = AdWordsApp.adGroups()
      .withCondition('Name = "' + name + '"')
      .withLimit(1)
      .get();
  if (adGroupIterator.hasNext()) {
    return adGroupIterator.next();
  }
}

and in the ad I added a text that is including {param1}. This is not working, do you know why?

Thank you, Omry.


Umesh Dengale

unread,
Dec 3, 2015, 4:08:18 PM12/3/15
to AdWords API Forum
Hello,

In the AdWords API, you could use the Ad Customizers which are feed based and it is used for dynamically setting the information to your Ads. Please check out our Ad Customizers guide and the AddAdCustomizer Java example code from the client library.

Thanks,
Umesh, AdWords API Team.
Reply all
Reply to author
Forward
0 new messages