Stop Google Ads Budget Overspend with This Simple Script

I had the opportunity to present recently at a monthly meeting of the Utah Digital Marketing Collective (Utah DMC, formerly SLCSEM). I spoke about a handful of scripts that advertisers could put to use immediately. One of those scripts prevents Google Ads from spending 2X your daily budget on any given day. Several people were interested in the script which leads me to believe this is a more common issue than I thought. So I’m sharing it here to get it out there more.

Stop Daily Campaign Overspending

Back in October last year we got this “treat” of a tweet from AdWords:

The platform already “allowed” itself to overspend daily budgets by up to 20%. It has been a thorn we’ve all just accepted, but this was 5 times worse and foisted on all advertisers unilaterally. They did include this line to soften the blow, though – “Keep in mind, you won’t be charged more than your monthly charging limit: the average number of days in a month (30.4) multiplied by your average daily budget.”

Didn’t help much.

So let me help you stop this from happening in your account with a simple AdWords script. First, copy the following code:

function main() {
var allowedOverdeliveryPercentage = 0.2; // set percentage as decimal, i.e. 20% should be set as 0.2
var labelName = "Paused for Overdelivery";
AdWordsApp.createLabel(labelName, "automatic label needed to reenable campaigns");
var campaigns = AdWordsApp.campaigns()
.withCondition("Status = ENABLED")
.withCondition("Cost > 0")
var campaignIterator = campaigns.get();
while (campaignIterator.hasNext()) {
var campaign =;
var campaignName = campaign.getName();
var budgetAmount = campaign.getBudget().getAmount();
var costToday = campaign.getStatsFor("TODAY").getCost();
if(costToday > budgetAmount * (1 + allowedOverdeliveryPercentage)) {
Logger.log(campaignName + " has spent " + costToday + " which is more than allowed.");
} else {
Logger.log(campaignName + " has spent " + costToday + " and can continue to run.");

Then take these steps:

  • In Google Ads, click the Tools icon in the upper right corner (it’s a wrench)
  • Then click on Scripts in the Bulk Actions section
  • On the next page click the blue circle with a + sign in it (this is how you add a new script)
  • On this screen you will name your script. I recommend a very descriptive name like [account] – [what script does/campaigns it affects] – [how often it runs]
  • Copy/paste the code into the main section
  • Click Save (I’m just a little neurotic about losing work)
  • Authorize the script by clicking “Authorize” in the yellow bar. You’ll then have to double opt-in that you’re okay with running the script
  • Set the allowable over-delivery percentage in line 3 (instructions included in script text). You can use 0.2 to go back to pre-October 2017 behavior or choose your own level.
  • Click Save (yes, do it again)
  • Click Preview & then check the Changes & Logs tabs to make sure it will run successfully.
  • If everything checks out then click Run and you’re done

This script will run every hour and pause any campaign that goes over the threshold you set. It then reactivates it at midnight so it’s good for the next day.

If you liked this post, you may be interested in these posts:

How do you manage your AdWords budgets? We’d love to hear your tips in the comments!