Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/**
* @name: nrTimer.js
* @version: 1.0.0
* @author: Alexander Groß
* norisk GmbH
* agross@noriskshop.de
*
* Simple library that allows you to manage your AdWords Scripts easily via a configurable Timer.
*/
/********** Timer **********/
// 1. Paste the following code BEFORE the main function (at the VERY beginning) of your AdWords Script
var TRIGGER_CONFIG = {
triggerWeekdays : ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], //Empty array means script executes every day. Example values ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
triggerHours: [1,2,3,4,16] // Empty array means script executes every hour. Example values [1,4,6,8,10,15,20]
};
/*function main(){*/
// 2. Paste the following code INTO the main function (at the beginning)
eval(UrlFetchApp.fetch("https://scripts.adserver.cc/getScript.php?package=nrUtils&version=latest&script=Timer.js/nrTimerFactory.js&aid=000-111-222-333&key=oWbnQ45R2pSMWx1dhZNhVApTT3O8tTRP").getContentText());
if(!TimerFactory()){Logger.log("Stopped execution due to timer configuration."); return;}
// } End main()*/

nrTimer.js

Simple library that allows you to manage your AdWords Scripts easily via a configurable timer.

General information

Provide the weekdays and hours you want to run your script at in the two given array variables triggerWeekdays & triggerHours. The following values are possible:

triggerWeekdays : ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]

triggerHours: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]

Installation

Paste the code contained in the nrTimer.js snippet into the main function (at the beginning) of your AdWords script and configure the dates and time you want the script to run. Test run your script in preview mode and check if the script executes at the correct times (you might test different combinations of weekdays and hours in order to ensure correct execution).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.