A Script To Turn Your Holiday Ads On/Off
Holidays are great to spend with the family and friends, have a little extra time off, and make some more money! On the other hand… holidays are scheduling nightmares. The worst is when you have alternate hours and holiday specials that need to be switched on and off at certain times. Didn’t get your calendar reminder last year? Client or boss saw the wrong ads up when the ads the specials were over? Yeah, we’ve all had to dance a little more to enjoy our extra time off. Well, this time, I’ve got the script you need to rest easy.
This is actually fairly simple, and I’ll walk you through what you need to do. The script is written to be extremely simple.
The Scripts
The script starts by looking for ads with the label “Holiday”. Of course, in order to switch on ads you’ll want to flip on after the holidays, you’ll want to add the script a second time for when to pause the “Holiday” ads. You’ll need to do this twice for the other non-holiday ads with a label, such as “Non-Holiday”. Note that one says pause and the other says enable. I’ve added all four versions so you’ll just need to copy-paste, add your labels, and set schedules.
Holiday On
function main() { var adSelector = AdWordsApp .ads() .withCondition('LabelNames = "Holiday"'); var adIterator = adSelector.get(); while (adIterator.hasNext()) { var ad = adIterator.next(); ad.enable(); }
Holiday Off
function main() { var adSelector = AdWordsApp .ads() .withCondition('LabelNames = "Holiday"'); var adIterator = adSelector.get(); while (adIterator.hasNext()) { var ad = adIterator.next(); ad.pause(); }
Non-Holiday On
function main() { var adSelector = AdWordsApp .ads() .withCondition('LabelNames = "Non-Holiday"'); var adIterator = adSelector.get(); while (adIterator.hasNext()) { var ad = adIterator.next(); ad.enable(); }
Non-Holiday Off
function main() { var adSelector = AdWordsApp .ads() .withCondition('LabelNames = "Non-Holiday"'); var adIterator = adSelector.get(); while (adIterator.hasNext()) { var ad = adIterator.next(); ad.pause(); }
Final Note
As with any script, I recommend testing a couple times to make sure it’s right. Also, since Google may run the script from different time zones, Nathan Byloff’s solution will automatically detect that and run the script from your account’s time zone settings.