User Tools

Site Tools


check_existing_ad_schedule

This is an old revision of the document!


function main() {
  var campaignIterator = AdWordsApp.campaigns()
      .withCondition('Name = "INSERT_CAMPAIGN_NAME_HERE"')
      .get();
  if (campaignIterator.hasNext()) {
    var campaign = campaignIterator.next();
    var adScheduleIterator = campaign.targeting().adSchedules().get();
 
    while (adScheduleIterator.hasNext()) {
      var adSchedule = adScheduleIterator.next();
      Logger.log(formatSchedule(adSchedule));
      Logger.log('Bid modifier : ' + adSchedule.getBidModifier());
    }
  }
}
 
function formatSchedule(schedule) {
  function zeroPad(number) { return Utilities.formatString('%02d', number); }
  return schedule.getDayOfWeek() + ', ' +
      schedule.getStartHour() + ':' + zeroPad(schedule.getStartMinute()) +
      ' to ' + schedule.getEndHour() + ':' + zeroPad(schedule.getEndMinute());
}
check_existing_ad_schedule.1436563950.txt.gz · Last modified: 2015/07/10 23:32 by vincenzo