Improve Daily Budget Monitoring in Google Ads with This Simple Script

googleads_generic_blank

As we all know, managing budgets in Google Ads is not easy.

We’ve said it time and time again: Google has the ability to spend up to twice your campaign’s daily budget. That can be hard for any marketer, but especially if you’re managing a large account – or multiple accounts.

It’s a challenge we’ve been working around for years – literally. We first started using a script in 2019 to automate budget management and control spend. Then in 2021, we adjusted the script to work for multiple budgets.

Now we’ve made a new script – this time, to work for accounts that have high daily budgets or that you want to keep a closer eye on daily spend.

In this blog post, I’ll walk you through what the new script does and how to use it. (You can also watch my step-by-step tutorial video below.)

How to Use Budget Scripts to Manage Google Ads Accounts

The Problem

You’re a marketer. You’re busy. You don’t have time to go into your accounts every 30 minutes to check budgets.

So how do you keep a close eye on them and stop them from overspending?

The Solution

Our previous scripts helped, but we’re always looking for ways to improve. So we worked internally again to find a better solution for keeping a close eye on these daily budgets.

What we came up with is a script that sets a daily threshold, then emails us a warning when our campaigns have reached that threshold. It helps us keep spend on track and warns us if it’s getting too high on a certain day.

For example, let’s say we want an account to spend no more than $25,000 a day. We use this script to notify us when the account has spent $20,000. Depending on the time of day we get the warning email, we can go into the account and adjust budgets and campaigns to ensure we don't go over our daily goal of $25,000.

Internally, we use this script for larger accounts, but you can use it for accounts of any size.

How it Works

This free script is super easy to set up and could ultimately save you a lot of time and stress worrying about daily budgets.

Once you’ve set it up, it will monitor your ad spend and email you a warning notification each hour after you’ve reached the daily threshold you set.

For example, if you reach your spend limit at 5 p.m., you’ll get notification emails every hour starting at 5 p.m.

How to Set it Up

1. Under the “Tools” menu in Google Ads, find the “Bulk Actions” category and select “Scripts.”

2. Click the blue plus sign on the top left side of your screen to add a new script.

3. Enter a name for your script in the top left corner of the window. We named ours “Daily Spend Warning.”

4. Copy and paste this free script into the editor area:

/**
 * Cypress North Google Ads Script: Monitor Ad Spend & Send Email Alerts
 *
 * cypressnorth.com / Performance Marketing
 *
 * This script checks if the total ad spend exceeds a user-defined threshold.
 * If it does, an email notification is sent to a specified list of recipients.
 */

function main() {
  // --- User Configuration ---
  var spendThreshold = YOUR SPEND THRESHOLD;
  var recipientEmails = ["YOUR EMAIL A, YOUR EMAIL B"];
  var dateRange = "TODAY";
  // -------------------------

  try {
    Logger.log("Script execution started. Account: " + AdsApp.currentAccount().getName() + ", Date Range: " + dateRange);

    var accountStats = AdsApp.currentAccount().getStatsFor(dateRange);
    var totalSpend = accountStats.getCost();

    Logger.log("Spend Threshold: $" + spendThreshold);
    Logger.log("Total Spend: $" + totalSpend);

    if (totalSpend > spendThreshold) {
      var subject = "Google Ads Spend Alert: " + AdsApp.currentAccount().getName();
      var body = "Ad spend for " + AdsApp.currentAccount().getName() + " exceeded $" + spendThreshold + " (" + dateRange + "). Current spend: $" + totalSpend;

      MailApp.sendEmail({
        to: recipientEmails.join(","),
        subject: subject,
        body: body,
      });

      Logger.log("Alert email sent to: " + recipientEmails.join(","));
    } else {
      Logger.log("Spend is below threshold.");
    }

  } catch (error) {
    Logger.log("Error: " + error.message);
    Logger.log("Stack Trace: " + error.stack);
    try {
      MailApp.sendEmail({
        to: recipientEmails.join(","),
        subject: "Google Ads Script Error",
        body: "Error in Google Ads spend alert script: " + error.message + "\n\nStack Trace: " + error.stack,
      });
      Logger.log("Error email sent.");
    } catch (mailError) {
      Logger.log("Failed to send error email: " + mailError.message);
    }
  } finally {
    Logger.log("Script execution finished.");
  }
}

5. You’ll set your daily spend threshold where the code says YOUR SPEND THRESHOLD (on line 12.) We recommend setting it around 20% below your total daily budget.

6. You’ll also need to replace the "YOUR EMAIL A, YOUR EMAIL B" (on line 13.) Here’s where you’ll enter the emails of everyone who should receive the warning email separated by a comma and a space.

7. On the bottom right-hand corner of your screen, hit “Save” and then “Run.” You’ll see a pop-up asking whether you want to preview the script before running. Select “Run Without Preview.”

Note: If you want to test your script, set the threshold at an amount the account has already spent for the day, then check to see if you get the notification email. You can change the threshold at any time.

8. You’ll then see a yellow banner at the bottom of the Google Ads window asking you to authorize the script to run. Select “Authorize” and follow the steps for authorization.

9. Select “Scripts” on the left side of your screen to return to the general scripts page.

10. From this page, you’ll see all of the scripts in the account and can specify how often your scripts will run. Under the “frequency” column for the script you just created, select “hourly.”

And you're done!

Once your account reaches the daily spend threshold, you’ll receive an email every hour saying how much the account has spent for the day.

While we designed it internally as a solution for the large accounts we manage, this script can be used for any size account. It’s a great way to keep a close eye on daily spend and catch high spend days as they’re happening so you can make adjustments.

Having trouble managing your spend? Get in touch with us for help with your strategy!

Categories: Paid Search Marketing

Leave a Reply

Your email address will not be published. Required fields are marked *

Meet the Author

julia-web
Digital Marketing Strategist

Julia Meteer

Julia is a Digital Marketing Strategist who joined Cypress North in June 2022 and works out of our Buffalo office. She spends her days in the office working on campaign maintenance and budget tracking for our clients, in addition to other digital marketing tasks.

Originally from Corning, Julia attended James Madison University, where she earned a Bachelor’s Degree in marketing with a concentration in digital marketing.

Julia earned her HubSpot Email Marketing, HubSpot SEO, Google Analytics for Beginners, and Meta Digital Marketing Associate certifications during college. Since joining Cypress North, she has also become certified in Google Shopping Ads, Google Ads Search, and Google Ads Display.

Before joining our agency, Julia gained work experience as a Digital Marketing Intern at a small agency in her hometown.

Julia enjoys hiking, exploring Buffalo, and watching New Girl or Grey's Anatomy when she's not working.