You may be running 100 campaigns, where you don’t want to limit any individually by budget, but still want to keep your budget under control by pausing them once a daily, weekly or monthly spend is reached. This is particularly useful when initially posting campaigns, especially those further segmented by location, match type or other considerations.
Michael Rojek
This flexible Google Ads automation script will let you pause campaigns when they reach a daily, weekly, or monthly threshold and then restart them when the next time range begins.
What Are Google Ads Scripts?
Google Ads (formerly known as AdWords) scripts are written in JavaScript, and designed to give you more control over your paid search campaigns. If you want to try a simple “getting started” script, check out the Google Ads scripts from Google Developers. You will need to be comfortable with code/scripting to make edits, but don’t worry, it’s simple!
Using Scripts to Automate your Google Ads Campaigns
As your Google Ads campaigns start scaling with need, automation becomes more and more appealing. However, a script that monitors and pauses campaigns based on overall budget criteria can act as a final safety brake. This way, any changes you test or expansions you implement won’t exhaust your budget.
Using scripting to automate your Google Ads campaigns can be a very simple and effective way of boosting the performance and security of your campaigns. However, there is also the risk of scripts not running as expected. These scripts have broad permission to make changes to your accounts, so always be careful with which scripts you intend to use. Google Ads scripts are written in JavaScript, and familiarity with JS or programming/scripting in general will help you understand what is being changes, and to make adjustments as needed to fit your own needs.
Scripts are available in the Bulk Actions section of the Google Ads console. You can find them in your console by selecting Tools and Settings at the top right of the console, and selecting Scripts under Bulk Actions. Here you will be able to see all the scripts you currently have in your account, their status and frequency of action.
Setting up a Budget Automation Script
Before you start uploading your code, you need to name your script and authorize it. You need to be using an account that has the necessary permissions, as these scripts can have broad control over your account. In our case, let’s name it Daily Budget
Ready to get started? You can find the budget automation script at GitHub. Once you’ve named your script and given it authorization, you can simply copy/paste the code from GitHub into your browser. There’s no need for any text editor, everything is available from within the console. The example code on BitHub uses a monthly budget range and maximum spend of 500 of whatever currency your account is set for. While there is quite a bit of code here, you only need to worry about the settings that start on line 8:
//var SETTINGS = new Object();
currentSetting = new Object();
currentSetting.scope = “Account”;
currentSetting.maxCost = getFloat(“500”);
currentSetting.budgetPeriod = “Daily”;
currentSetting.labelName = “”;
currentSetting.labelToAdd = “stopped by budget script”;
currentSetting.email = “[email protected]”;
currentSetting.pauseItems = “yes”;
currentSetting.reEnableItems = “yes”;
In particular, we only need to pay attention to:
- currentSetting.maxCost – which will let you set the maximum spend
- currentSetting.budgetPeriod – which will let you set the monitored range
- currentSetting.email – the e-mail address to send updates to
Daily Google Ads Budget Script
The daily budget script is likely the most useful to search engine marketing campaign managers. You can set a maximum daily spend for your entire account, regardless of individual campaign budgets. Once the budget is reached, your campaigns will be paused until the following day, when they will be automatically re-enabled. Useful, right?
To set this up you need to edit the script settings. Change maxCost to whatever your maximum daily spend is (for example “500”, change budgetPeriod to “Daily” and make sure you set the correct e-mail address you would like to be notified at. Make sure your setting values are within quotes, and have a semi-colon at the end of each line.
Weekly and Monthly Google Ads Budget Script
Setting a weekly or monthly time range is as easy as adjusting the budgetPeriod setting to “Weekly” or “Monthly”. Keep in mind, however, that once this budget is reached your campaigns will be paused until the next period, which may be days or even weeks away.
Google Ads Automation Scripts
Scripts in Google Ads give you the ability to exert specific and custom control over your search engine marketing campaigns, far exceeding the capabilities that are built into the Google Ads console. The possibilities are endless, so if there is any task you’d like automated or functionality in Google Ads you find missing, it may be a simple question of typing that request into your search box! Or, better yet, why not explore the flexibility of the platform and check out some of the most useful scripts that are available.
Scripts and rules help give us more control over our search engine marketing campaigns, doing everything from managing budgets to adjusting bids based on third-party data.