Here’s a Brainlabs script to regain control of your AdWords budgets

Here’s a Brainlabs script to regain control of your AdWords budgets

In case you hadn’t already heard, AdWords can now spend up to double your campaign’s daily budget.

We’ve already had time to let all our emotions out about this, so no need to manifest them in the public arena. Instead, as always, let’s see if we can’t API our way out of this mess.

The main reason why this change is bad: most businesses don’t have unlimited money to throw at their ads, or unlimited resources to deal with new buyers. And even if you’re the biggest spender in the ad world, a sudden increase in traffic is not always a good thing—it may be a surge in searches around some new scandal, or tyre-kickers looking into a new trend.

At the very least you should know when the overspend is happening, so you can judge for yourself whether said overspend should continue.

If you’d really like to keep a close eye on costs, have a look at our script to track your account’s spend every hour. For those that only want to be alerted when campaigns are over their budgets, this is where the new script comes in!

Our latest script checks each campaign’s spend and budget. All you need to do is set a multiplier threshold—if the spend is larger than the budget multiplied by the threshold, then the campaign is labelled. You’ll get an email listing the newly labelled campaigns, along with their spend and budgets. And if you want, you can set another threshold so that if the spend gets far too over your budget the campaign will be paused.

The script also checks if the campaign’s spend is under your labelling and pausing thresholds, so it can unlabel and unpause them. That means when it’s a new day, and nothing has been spent yet, the labels will be removed and anything the script has paused will be reactivated. It also means that if a campaign is over budget but you increase its budget, the labelling and status will reflect the new, increased budget.

To use the script, copy the code below into a new AdWords Script and change the settings at the top:

  • campaignNameContains and campaignNameDoesNotContain filter which campaigns the script will look at. For example, if campaignNameContains is  [“Generic”, “Competitor”] then only campaigns with names containing “generic” or “competitor” will be labelled or paused. If campaignNameDoesNotContain is [“Brand”, “Key Terms”] then any campaigns containing “brand” or “key terms” in the name will be ignored (and can overspend as they like).
    • This is not case-sensitive.
    • Leave blank, [], to include all campaigns.
    • If you need to put a double quote into campaignNameContains or campaignNameDoesNotContain, put a backslash before it.
  • email is a list of addresses that will be emailed when campaigns are labelled or paused.
    • Note that emails will be sent even when the script is being previewed and not making changes.
  • currencySymbol, thousandsSeparator and decimalMark are used to format the budget and spend numbers in the email.
  • labelThreshold determines how much the campaign must spend, compared to its budget, for the script to label it as overspending.
    • For example if you set labelThreshold to 1 then campaigns will be labelled and you will be emailed if the spend is equal to the budget. If you set it to 1.2 then the campaign is labelled and email sent if spend is 120% of the budget.
  • labelName is the name of the label that will be applied to overspending campaigns.
  • Set campaignPauser to true if you want campaigns too far over their budgets to be paused. Set it to false if you do not want the script to pause campaigns, no matter how much they spend: the script will still label (and email you) according to the labelThreshold.
  • pauseThreshold determines how much the campaign must spend, compared to its budget, for the script to pause it (if campaignPauser is true).
    • This works the same as labelThreshold: if it is 1.2, then campaigns will be paused if their spend is 120% of the budget.
    • This must be greater than or equal to the labelThreshold. The script needs the paused campaigns to be labelled, so it knows which to reactivate when their spend becomes lower.

Preview the script to make sure it’s working as expected (and check the logs in case there are any warnings). Then set up a schedule so the script runs hourly.

A few things to note:

  • The script only works with search and display campaigns! It can’t help with video, shopping or universal app campaigns.
  • This script can’t completely prevent you going over budget. The script only runs hourly, so the campaign can go over the spend threshold between runs. And there’s a 15–20 minute lag in the spend data.
  • Scheduled scripts don’t run on the hour, so campaigns will not be reactivated as soon as a new day begins. Instead they’ll be reactivated when the script first runs on the new day, sometime between midnight and 1am. Most campaigns receive little traffic at this time anyway—but if that’s not the case for you, you might want to set up automated rules to unpause things exactly as midnight strikes.
  • You can set labelThreshold to be less than 1. For example, if you set it as 0.9 you’ll get an email when the campaign reaches 90% of its budget.


Share this post