For a newer article on this topic visit: Automate And Better Manage Your Budgets With Scripts


 

At the recent HeroConf in London, I had the pleasure of meeting several customers of Optmyzr. One of them told me they had to spend a significant amount of time ensuring that none of the accounts they managed would exceed the monthly budget set by their clients and that got me thinking about a new AdWords script to build. This month I’ll share a script I wrote that makes AdWords budgets more flexible and advanced.

Why Use AdWords Scripts To Solve The Problem With Budgets

I wrote an early version of this script when a friend asked if I could automate enforcing budgets at a more granular level than campaigns, the level at which AdWords budgets are maintained. You could achieve a similar automation very easily using Automated Rules but the downside is that they can only run once per day and that’s simply not frequent enough when money is at stake. Because scripts can run more often, as frequently as once per hour, I decided to go this route. If more frequent checks were necessary, an API-based solution would be better but it would involve more overhead in terms of maintaining servers and cron jobs. So scripts provide a nice combination of being powerful yet cost effective.

Use Cases

The advanced budget script can be used to address several use cases:

1. Enforce Account Budgets

Budgets in AdWords are set at the campaign level. You can use a shared budget and assign all campaigns to it to get an account-level budget, but then you lose the ability to dedicate more money to higher performing campaigns.

At Optmyzr, we have talked at length about budget management techniques during our daily product meetings and the bottom line is that we’re not big fans of shared budgets because we believe better results can generally be achieved with more granular management. Despite this philosophy, I think shared budgets are useful because many advertisers don’t have time to manage things as granularly as they should. However, for those who want to get the very best results — and I assume that includes you: readers of the PPC Hero blog — it’s better to manage the budget for each campaign separately.

So the first use case is simple, the script pauses all active campaigns when an account’s cost goes above a certain threshold for the month. You still set campaign level daily budgets but as soon as the total cost for the account gets too high, everything is paused.

2. Maintain Monthly Budgets

It could be argued that simply dividing a monthly budget evenly between all days is a fine way to turn the daily budgets AdWords uses into the monthly budgets that a typical business thinks about. But just like shared budgets are not great because you give up granularity, daily budgets that are the same every day don’t give you the control to spend money when it will lead to the best returns.

December’s a great example of a month when you might not want your monthly budget evenly split between all days. Retailers know that the biggest opportunity for moving merchandise will come before Christmas. With daily budgets in AdWords, you might set higher daily budgets for Dec 1-24 than for Dec 25-31. That creates the risk that you could spend more than intended for the entire month. This script lets advertisers enforce a budget for a date range other than daily so that a campaign can automatically be paused when the cost starts to exceed the maximum allowed for the month, regardless of daily budget.

The script can also be set to check budgets daily, weekly from Sunday through today, or weekly from Monday through today.

3. Apply Small Budgets To Tests

If you have a campaign that’s working really well and for which you’ve set a high budget, you might be worried that testing new ads or keywords could lead to accidentally spending a lot of money on something that performs worse than expected. Here’s a simple example that illustrates the issue: you have a campaign with a $1,000 budget with all exact match keywords that usually produce an ROAS of about 10. Then you add a pretty generic broad match keyword and before you know it this new keyword has spent 90% of that campaign’s budget and is losing money. It stole the budget from what you knew was going to perform well and now you’re left with a loss for the day.

With this script, you can enforce small budgets down to the keyword or ad level. These experimental items can still go into your existing campaigns so you don’t need to maintain separate campaigns for testing.

The script can check budgets at the keyword, ad, ad group, campaign or account level.

Script Settings

First, get a copy of the script code from BitBucket and install it into an individual AdWords account (NOT an MCC account)

Here are the lines you’ll need to update in the script to make it work:

currentSetting.scope = “Account”;
Enter a value of either: Account, Campaign, Ad Group, Keyword, or Ad
This is the level at which the maximum budget will be enforced.

currentSetting.maxCost = parseFloat(“1”);
Enter a decimal value that represents the maximum cost each item is allowed to have.

currentSetting.budgetPeriod = “Daily”;
Enter a value of either: Daily, Monthly, Weekly Sun-Sat, Weekly Mon-Sun
This is the time frame for the budget, i.e. the period during which the maximum cost can be accrued.

currentSetting.labelName = “Label name to check”;
Enter the name of the label that you’ve added to the items you want the script to check. If you want to check all items of your selected scope (e.g. all keywords), then leave this blank.

currentSetting.labelToAdd = “stopped by budget script”;
Enter the name of the label you want the script to add to all items that exceed the allowed budget. This will make it easy for you to find these items in an account, and it is also needed for the script to know what should be re-enabled at the start of a new period.

currentSetting.email = “example@example.com”;
Enter the email address of the person to notify whenever a budget has been exceeded or whenever the script makes any changes to the account.

currentSetting.pauseItems = “yes”;
Enter a value of either: yes, no
This says if the script should pause items that exceeded the budget (yes) or not (no).

currentSetting.reEnableItems = “yes”;
Enter a value of either: yes, no
This says if the script should re-enable any items that were paused by the script when a new budget period commences. The script must be set to run hourly for this to work.

Conclusion

This is a simple script, but hopefully it will help you alleviate some of the issues related to how AdWords treats budgets. If you want a version of this that we maintain whenever AdWords makes updates, that works with MCC accounts, that works for Shopping campaigns, and that has a nice and easy web based user interface for changing settings (i.e. no need to change lines of code), check out Enhanced Scripts from my company Optmyzr.