Skip links
Google Ads daily spend cap script pausing an overspending campaign

Google Ads Daily Budget Isn’t a Daily Limit: A Free Script to Cap Campaign Spend

Google Ads can spend up to double your daily budget on any given day. If you or your clients need a real daily ceiling, the free script below pauses any campaign that goes over its cap and switches it back on after midnight.

We built it after a familiar conversation with a budget-focused client. A campaign set at $250 a day spent over $500 on two consecutive days, with not a single enquiry to show for it. The question was fair: “How can it spend double what I set?”

We’ve explained Google’s budget logic many times. But explaining it doesn’t give a client control. A hard brake does.

How Google’s daily budget actually works

Your “daily budget” is an average, not a limit. Google applies two caps instead (Google Ads Help):

  • Daily: a campaign can be charged up to 2x its average daily budget on any single day.
  • Monthly: it won’t be charged more than 30.4x the daily budget in a calendar month (30.4 = the average number of days in a month).

So a $250/day campaign can legitimately spend $500 today, as long as the month stays under $7,600.

The June 2026 change made this worse for scheduled campaigns. From 1 June 2026, campaigns switched off on certain days of the week (e.g. weekdays only) now pace towards the full 30.4x monthly amount, not just the days they run (Google Ads Help). A weekday-only campaign at $250/day now tries to fit about $7,600 into roughly 22 days. That works out to around $345 a day on average, with regular pushes to the $500 ceiling.

On the trails, I don’t care what my average speed is on a descent. I care that my brakes work on every corner. Clients feel the same way about ad spend.

Why an automated rule isn’t enough

There are two native fixes, and both fall short:

  • Halve the daily budget. Setting $150 guarantees a $300 daily maximum, but it also cuts the monthly ceiling in half. You lose volume on good days to protect against bad ones.
  • An automated rule (“pause when cost today > $X”). Rules run at most once an hour, can’t tell a campaign you paused on purpose from one the rule paused, and offer little room to customise. One expensive hour can blow straight past the cap.

We wanted the budget left alone, more frequent checks, per-campaign control and alerts. So I wrote a script.

What the script does

  • Checks every enabled campaign about 3 times an hour.
  • Pauses only the campaign that crosses its cap. Everything else keeps running.
  • Emails your team the moment a campaign is paused, and again when it’s switched back on.
  • Switches it back on after midnight, in the account’s own time zone.
  • Never touches campaigns you paused on purpose.
  • Lets you set different caps for specific campaigns, or exclude campaigns entirely.
  • Works across Search, Display, Shopping and Performance Max.

How it works under the hood

Google Ads scripts can only be scheduled hourly, so the script gets more checks out of each run:

  1. Every hour, the script starts and pulls today’s cost for every campaign.
  2. It checks each enabled campaign against its cap. If cost today is over the cap, it pauses that campaign, adds the label SpendCap-Paused and sends an email alert.
  3. It waits 13 minutes and checks again, then again 13 minutes later. Scripts are cut off at 30 minutes, so it stops at 28. That gives roughly 3 checks an hour instead of 1.
  4. After midnight, cost today resets to zero. On the first run of the new day, any paused campaign that carries the label is switched back on and the label is removed.

The label is what keeps your manual pauses safe. A campaign you pause yourself never gets the label, so the script never switches it back on.

Setup in 5 minutes

  1. In Google Ads, go to Tools > Bulk actions > Scripts and click + to create a new script.
  2. Delete the placeholder code and paste in the full script below.
  3. Edit the CONFIG section at the top:
    • DEFAULT_CAP: the daily cap per campaign, in the account’s currency (e.g. 300).
    • EMAIL: alert recipients, comma-separated (e.g. 'you@company.com,team@company.com'), or '' for no emails.
    • EXPECTED_CURRENCY: optional safety check (e.g. 'AUD'). The script stops if the account currency doesn’t match.
    • CAP_OVERRIDES: optional different caps for specific campaigns, using exact campaign names.
    • EXCLUDE: optional campaigns the script should never pause.
  4. Authorise the script. If no prompt appears, click Preview to trigger it, and allow pop-ups for ads.google.com.
  5. Click Preview. The log should list each enabled campaign with its cost so far today and its cap. Preview makes no changes.
  6. Save, then set the frequency to Hourly.

Day-to-day use and limitations

Handy controls

  • To keep a script-paused campaign off past midnight, remove the SpendCap-Paused label from it.
  • To let a script-paused campaign run again today, add it to EXCLUDE or give it a higher cap in CAP_OVERRIDES. If you just switch it back on, the next check pauses it again.
  • New campaigns are covered automatically once they’re enabled.

Limitations, honestly

  • It’s a strong brake, not a wall. Google’s cost data isn’t real-time, and there’s a gap of about 30 minutes each hour between checks. Spend can go past the cap before the next check catches it. If the cap must never be exceeded, set it 10–15% below your true limit.
  • Re-enabling isn’t instant. It happens on the first hourly run after midnight, so somewhere between 12:00 and 1:00am account time.
  • Not covered: Demand Gen, Video and App campaigns, which scripts handle differently.
  • One account at a time. Install it in each account separately, not at manager (MCC) level.

The script

Copy everything below and paste it into a new Google Ads script. You only need to edit the CONFIG section.

/**
 * ============================================================
 *  DAILY SPEND CAP — Google Ads Script
 *  Created by Raphael Sebbag @ Digital Autopilot
 * ============================================================
 *
 * WHAT IT DOES
 * Google Ads can spend up to 2x a campaign's average daily budget
 * on any single day. This script adds a hard-stop guardrail:
 * - Watches every ENABLED campaign in the account.
 * - If a campaign's cost today goes above its cap, the script
 *   pauses that campaign only and adds a label to it.
 * - After midnight (account time zone), it re-enables only the
 *   campaigns it paused itself, and removes the label.
 * - Optional email alerts on every pause and re-enable.
 *
 * Campaigns paused manually are NEVER switched back on, because
 * they don't carry the script's label.
 *
 * ------------------------------------------------------------
 * SETUP (5 minutes)
 * ------------------------------------------------------------
 * 1. In Google Ads: Tools > Bulk actions > Scripts > + (new script).
 * 2. Delete the placeholder code and paste in this entire script.
 * 3. Edit the CONFIG section below:
 *      DEFAULT_CAP        Daily cap per campaign, in the account's
 *                         currency (e.g. 299).
 *      EMAIL              Alert recipients, comma-separated, or ''
 *                         for no emails.
 *      EXPECTED_CURRENCY  Optional safety check (e.g. 'AUD', 'USD').
 *                         The script stops if the account currency
 *                         doesn't match. Leave '' to skip.
 *      CAP_OVERRIDES      Optional different caps for specific
 *                         campaigns (exact names).
 *      EXCLUDE            Optional campaigns the script must never
 *                         pause (exact names).
 * 4. Click Authorise when prompted. If no prompt appears, click
 *    Preview to trigger it, and allow pop-ups for ads.google.com.
 * 5. Click Preview. The log should list each enabled campaign
 *    with its cost so far today and its cap. No changes are made
 *    in Preview.
 * 6. Save, then set Frequency to Hourly.
 *
 * ------------------------------------------------------------
 * DAY-TO-DAY USE
 * ------------------------------------------------------------
 * - Keep a script-paused campaign OFF past midnight:
 *   remove the label "SpendCap-Paused" from it.
 * - Let a script-paused campaign run again TODAY:
 *   add it to EXCLUDE or give it a higher cap in CAP_OVERRIDES.
 *   (If you just re-enable it, the next check pauses it again.)
 * - New campaigns are capped automatically once enabled.
 *
 * ------------------------------------------------------------
 * LIMITATIONS — PLEASE READ
 * ------------------------------------------------------------
 * - Google Ads scripts can run at most hourly. Each run re-checks
 *   spend every ~13 minutes for up to 28 minutes (scripts are cut
 *   off at 30), giving ~3 checks per hour with a ~30-minute gap.
 * - Google's cost data is not real-time and can lag. Spend can go
 *   past the cap before the next check catches it. If the cap must
 *   never be exceeded, set DEFAULT_CAP 10-15% below your true limit.
 * - Re-enable happens on the first hourly run after midnight
 *   (between roughly 12:00 and 1:00am account time).
 * - Covers Search, Display, Shopping and Performance Max campaigns.
 *   Demand Gen, Video and App campaigns are ignored.
 * - Single-account script. Install it separately in each account
 *   (not at manager/MCC level).
 * ============================================================
 */

var CONFIG = {
  DEFAULT_CAP: 300,          // per campaign, per day, account currency

  CAP_OVERRIDES: {
    // 'Exact Campaign Name': 150,
  },

  EXCLUDE: [
    // 'Exact Campaign Name',
  ],

  EMAIL: '',                 // e.g. 'name@company.com,name2@company.com'
  EXPECTED_CURRENCY: '',     // e.g. 'AUD'. Leave '' to skip the check.

  LABEL: 'SpendCap-Paused',  // change only if this name is already in use
  CHECK_EVERY_MIN: 13,       // minutes between checks within a run
  MAX_RUNTIME_MIN: 28        // keep under Google's 30-minute limit
};

// ============================================================
// Nothing below this line needs editing.
// ============================================================

function main() {
  var account = AdsApp.currentAccount();
  if (CONFIG.EXPECTED_CURRENCY &&
      account.getCurrencyCode() !== CONFIG.EXPECTED_CURRENCY) {
    var warn = 'Account "' + account.getName() + '" is in ' +
               account.getCurrencyCode() + ', not ' +
               CONFIG.EXPECTED_CURRENCY + '. Script stopped.';
    Logger.log(warn);
    notify_('Currency mismatch', warn);
    return;
  }

  ensureLabel_();
  var start = Date.now();
  var preview = AdsApp.getExecutionInfo().isPreview();
  var pass = 0;

  while (true) {
    pass++;
    runCheck_(pass);

    if (preview) {
      Logger.log('Preview mode: single pass only, no changes applied.');
      break;
    }
    var elapsedMin = (Date.now() - start) / 60000;
    if (elapsedMin + CONFIG.CHECK_EVERY_MIN > CONFIG.MAX_RUNTIME_MIN) break;
    sleepMinutes_(CONFIG.CHECK_EVERY_MIN);
  }
}

function runCheck_(pass) {
  var costs = getTodayCosts_();
  var now = nowStr_();
  var account = AdsApp.currentAccount();
  var accountName = account.getName();
  var cur = account.getCurrencyCode();

  forEachCampaign_(function (c) {
    var name = c.getName();
    if (CONFIG.EXCLUDE.indexOf(name) !== -1) return;

    var cap = CONFIG.CAP_OVERRIDES.hasOwnProperty(name)
      ? CONFIG.CAP_OVERRIDES[name] : CONFIG.DEFAULT_CAP;
    var cost = costs[String(c.getId())] || 0;

    if (c.isEnabled() && cost > cap) {
      c.pause();
      c.applyLabel(CONFIG.LABEL);
      var msg = now + ' | ' + accountName + ' | PAUSED "' + name +
                '" — cost today ' + cost.toFixed(2) + ' ' + cur +
                ' > cap ' + cap + ' ' + cur;
      Logger.log(msg);
      notify_('Paused: ' + name, msg +
        '\n\nIt will switch back on automatically after midnight.' +
        '\nTo keep it off, remove the label "' + CONFIG.LABEL + '".');

    } else if (c.isPaused() && hasLabel_(c) && cost <= cap) {
      c.enable();
      c.removeLabel(CONFIG.LABEL);
      var msg2 = now + ' | ' + accountName + ' | RE-ENABLED "' + name + '"';
      Logger.log(msg2);
      notify_('Re-enabled: ' + name, msg2);

    } else if (c.isEnabled() && pass === 1) {
      Logger.log(now + ' | "' + name + '" cost today ' +
                 cost.toFixed(2) + ' / cap ' + cap + ' ' + cur);
    }
  });
}

// ---------- helpers ----------

function getTodayCosts_() {
  var map = {};
  var rows = AdsApp.search(
    'SELECT campaign.id, metrics.cost_micros FROM campaign ' +
    'WHERE segments.date DURING TODAY'
  );
  while (rows.hasNext()) {
    var r = rows.next();
    map[String(r.campaign.id)] = Number(r.metrics.costMicros) / 1e6;
  }
  return map;
}

function forEachCampaign_(fn) {
  var selectors = [
    AdsApp.campaigns(),               // Search & Display
    AdsApp.shoppingCampaigns(),
    AdsApp.performanceMaxCampaigns()
  ];
  selectors.forEach(function (sel) {
    var it = sel.get();
    while (it.hasNext()) {
      var c = it.next();
      if (!c.isRemoved()) fn(c);
    }
  });
}

function hasLabel_(c) {
  var it = c.labels().get();
  while (it.hasNext()) {
    if (it.next().getName() === CONFIG.LABEL) return true;
  }
  return false;
}

function ensureLabel_() {
  var it = AdsApp.labels().get();
  while (it.hasNext()) {
    if (it.next().getName() === CONFIG.LABEL) return;
  }
  AdsApp.createLabel(CONFIG.LABEL, 'Paused by Daily Spend Cap script');
}

function sleepMinutes_(min) {
  var ms = min * 60000;
  while (ms > 0) {
    var chunk = Math.min(ms, 300000); // Utilities.sleep max = 5 min
    Utilities.sleep(chunk);
    ms -= chunk;
  }
}

function notify_(subject, body) {
  if (!CONFIG.EMAIL || AdsApp.getExecutionInfo().isPreview()) return;
  MailApp.sendEmail(CONFIG.EMAIL, '[Spend Cap] ' + subject, body);
}

function nowStr_() {
  return Utilities.formatDate(new Date(),
    AdsApp.currentAccount().getTimeZone(), 'yyyy-MM-dd HH:mm');
}

Frequently asked questions

Why is Google Ads spending more than my daily budget?

Google treats your daily budget as an average, not a limit. On any single day, a campaign can be charged up to twice its average daily budget. Over a calendar month, it won’t be charged more than 30.4 times the daily budget. So a $250/day campaign can spend $500 in one day and still be within Google’s rules.

Can I set a hard daily spend limit in Google Ads?

Not directly. The only native guarantee is to set the daily budget to half your true ceiling, since Google can spend up to 2x. That also halves your monthly maximum. The alternative is a script or automated rule that pauses a campaign once today’s cost passes your cap, then switches it back on the next day.

What changed with Google Ads budget pacing in June 2026?

From 1 June 2026, campaigns switched off on certain days of the week now pace towards the full monthly limit of 30.4x the daily budget. Previously they paced to the daily budget times the number of days they ran. Weekday-only campaigns now tend to spend more on the days they do run, often up to the 2x daily cap.

Is a Google Ads script better than an automated rule for capping spend?

For this job, yes. Both can only be scheduled hourly, but a script can re-check spend several times within each run, about 3 times an hour here. A script can also skip campaigns you paused on purpose, apply different caps per campaign, and email your team. An automated rule checks once an hour and can’t tell your manual pauses apart from its own.

Will the script switch on campaigns I paused manually?

No. The script adds a label (SpendCap-Paused) to every campaign it pauses, and only re-enables campaigns carrying that label. A campaign you pause yourself never gets the label, so it stays off. To keep a script-paused campaign off past midnight, remove the label.

Can spend still go over the cap?

Yes, slightly. Google’s cost data isn’t real-time, and there’s a gap of about 30 minutes each hour between checks. A busy stretch can push past the cap before the next check catches it. If the cap must never be exceeded, set it 10–15% below your true limit.

Does the script work with Performance Max and Shopping campaigns?

Yes. It covers Search, Display, Shopping and Performance Max campaigns. Demand Gen, Video and App campaigns are handled differently by Google Ads scripts, so it ignores them.

Is the script free to use?

Yes. Copy it, change it and use it in as many Google Ads accounts as you like. Install it separately in each account, not at manager (MCC) level.

Use it, tweak it, share it

The script is free to use, change and share. It won’t fix a campaign that’s attracting the wrong clicks, but it will stop one bad day from becoming an expensive one, and it gives budget-focused clients the control they’re asking for.

Want a second pair of eyes on why a campaign is overspending in the first place? Get in touch with Digital Autopilot for a free Google Ads audit.

  • headshot or Raph Sebbag on white background

    With 15+ years of PPC & SEO marketing experience, Raph is obsessed with delivering tangible and life-changing results for his clients, often generating 8x or more ROI. On the home front, he's a dad to five great kids, but his amazing wife would argue there’s a sixth kid in the mix (guess who that is!) - to help around the house, he gets out of everyone's way through therapeutic mountain biking!

    View all posts

Get FREE Audit and Strategy

You’re almost there. We can’t wait to hear how we can help you on your growth journey.

Get The Ultimate Digital Marketing Roadmap

...and grow your traffic leads and sales