The Holiday Day Parting Post

Posted on October 20, 2014 in

Don’t Let Client Schedule Changes Keep You Up At Night

This is the sister post to The Holiday Ads Post. The last one was about changing which ad copy was active at different times. This one is about changing your campaign day parting. The same concept applies here.

You know that Black Friday, Cyber Monday, and several other shopping holidays are on their way. Your client has big sales that suddenly end at midnight, December 31st. Without having great offers, your results are going to change back into a pumpkin. Naturally, you’ve got better things to do that sit there bleary eyed, fiddling with the ad schedules for 15 different campaigns at odd hours. That is assuming your calendar alert was successful in getting your attention in the first place.

The Challenge of Writing the Script

AdWords has a series of code snippets that are great as a beginning. But they are just that, a beginning. I was able to use one of the Script snippets to set a schedule. But, I was unsuccessful at over-writing an existing schedule with a script. I found the only way to get it to work was to have the script actually remove the existing schedule altogether, then place the new ad schedule.

The Script

The way I expect this to be used is to have a standard schedule which is saved as one script. This can be handy if you ever need to reference back to it. Every holiday will need its own revised script. Run the holiday script when those hours begin once. Run the standard schedule to reset the times. The script below is looking for campaigns with the label “Evening”. It removes any existing ad schedule for those campaigns and replaces them with a Monday-thru-Friday schedule of 7am to 9pm.

// Change Mobile Bid Percentage One Time
// Author: Kevin Adams
// Date: 2014-10-13

// Add the script at for each time you need the schedule changed.
// The script looks for campaigns with the label "Evening".

// For each time slot, the format is as follows:
// Day of the week, hour start, minute start, hour end,
// minute end, bid modifier.

// Uses military time and every slot for each day will need
// to be preceded by campaign.addAdSchedule

function main() {
var campaignIterator = AdWordsApp.campaigns()
.withCondition('LabelNames = "Evening"')
.get();
while (campaignIterator.hasNext()) {
var campaign = campaignIterator.next();
var adScheduleIterator = campaign.targeting().adSchedules().get();
campaign.addAdSchedule
('MONDAY', 7, 0, 21, 0, 1.0);
campaign.addAdSchedule
('TUESDAY', 7, 0, 21, 0, 1.0);
campaign.addAdSchedule
('WEDNESDAY', 7, 0, 21, 0, 1.0);
campaign.addAdSchedule
('THURSDAY', 7, 0, 21, 0, 1.0);
campaign.addAdSchedule
('FRIDAY', 7, 0, 21, 0, 1.0);
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.remove();
}

Conclusion

As with all automation, test, test, test. Extra careful precaution needs to be taken if you require complex changes for different times of the day and different days of the week to avoid overlapping times. As with all AdWords Scripts that depending on timing, don’t forget to check out Nathan Byloff’s Script that makes sure your Script runs using the same time zone as your account settings.

Now, go make some money!

By Kevin Adams

Kevin Adams has been doing PPC since 2004. He has managed many accounts from local service companies to large mortgage companies. His primary proficiencies are Google AdWords, Google Analytics, and Bing Ads. He continually stays up-to-date on the latest tricks, tools and trends provided by the search engines. If there is one thing that Kevin excels at most is making his clients money with Pay-per-Click advertising.