Google Ads Script Intraday Spend Alert: Catch Midday Surges
Build a custom Google Ads script for intraday spend alerts via Slack. Catch midday overdelivery, runaway PMax spend, and click spikes in real time.
By AdTurbo Team · 2026-10-15
Every media buyer has experienced this nightmare: You open your account at 2:00 PM to check on a routine Tuesday, only to discover that your primary Performance Max or generic Search campaign has burned through 180% of its daily budget before lunch. A broad match keyword triggered a viral news query, a competitor launched an aggressive bid surge that dragged your automated target into an auction war, or Google’s algorithm decided today was the ideal day to utilize its 200% daily overdelivery allowance.
By the time Google Ads sends an official budget pacing email or your nightly dashboard refreshes, the capital is already gone.
Standard account anomaly detectors run once every 24 hours, alerting you retroactively to what broke yesterday. To protect margins and keep client accounts stable, you need an intraday spend monitoring system that polls your account hourly and fires a real-time notification into your team's Slack channel whenever an abnormal midday expenditure occurs.
In this comprehensive guide, we will break down the mechanics of Google's intraday budget pacing, write a complete, copy-paste Google Ads Script with Slack incoming webhook integration, and walk through threshold logic to eliminate false positives.
---
Why Standard Google Ads Budget Controls Fail Midday
To understand why an intraday alert script is non-negotiable, you must look at how Google Ads treats your daily budget settings behind the scenes.
The 200% Overdelivery Clause
When you set a daily budget of $100 for a campaign, you are not telling Google to stop spending at $100.01 today. You are agreeing to a monthly charging limit calculated as Daily Budget × 30.4. On any individual day, Google's automated bidding algorithms are permitted to spend up to two times (200%) your average daily budget if the system predicts higher search volume or elevated conversion intent.
While Google will credit back spend that exceeds your monthly cap at the end of the billing cycle, that protection offers zero comfort when:
1. A campaign drains two days of budget by 11:00 AM on irrelevant queries.
2. You are running short promotional campaigns (e.g., a 4-day flash sale) where monthly averaging never balances out.
3. Your client operates on strict weekly micro-budgets with fixed cash flow.
The Pitfalls of Daily Reporting Scripts
Most public script repositories feature daily budget scripts that check spend once per night at 11:30 PM. While useful for high-level pacing reports, finding out that a campaign overspent at 11:30 PM does not give you time to adjust bids, apply negative keywords, or pause runaway ad groups. You need an automated sentinel checking performance every hour between 8:00 AM and 6:00 PM.
If you find your campaigns regularly burning cash on poor-quality traffic before midday, you should also review our guide on how to use the Google Ads search terms report to cut wasted spend to ensure negative keyword lists are reinforcing your budget barriers.
---
Anatomy of an Hourly Spend Spike
Before writing code, let us define what constitutes a legitimate intraday spend surge versus normal auction ebb and flow. Not every morning expenditure requires an emergency Slack ping.
[Standard Intraday Pacing Curve]
08:00 AM: ~10% of Daily Budget Spent
12:00 PM: ~35% - 45% of Daily Budget Spent
04:00 PM: ~65% - 75% of Daily Budget Spent
08:00 PM: ~90% - 100% of Daily Budget Spent
[Runaway Surge Profile]
08:00 AM: ~25% of Daily Budget Spent (Early Warning)
11:30 AM: ~120% of Daily Budget Spent (CRITICAL ALERT TRIGGERED)
A flawed script evaluates spend in a vacuum (e.g., "Alert me if spend $200"). An effective script evaluates relative pacing against time of day.
The Ratio-to-Hour Formula
A robust intraday spend formula compares current expenditure against expected elapsed budget:
$\text{Pacing Ratio} = \frac{\text{Actual Spend Today}},{\text{Campaign Daily Budget} \times (\text{Current Hour} / 24)}$
However, search volume is rarely linear across 24 hours. Most B2B and e-commerce accounts see low traffic from midnight to 6:00 AM, followed by a sharp rise from 9:00 AM to 5:00 PM. A purely linear calculation produces false positives at 10:00 AM.
Instead, the most reliable script evaluates two simple, practical trigger conditions:
1. Absolute Budget Penetration: Spend today has exceeded a predefined percentage (e.g., 75%) of the total daily budget before a specific cutoff hour (e.g., 1:00 PM).
2. Runaway Multiplier: Spend today has already exceeded 100% of the daily budget at any point before 5:00 PM.
---
Architecture: Connecting Google Ads Scripts to Slack
Google Ads Scripts run on Google’s cloud servers using JavaScript (V8 engine). They have native access to your account data via AdsApp and can make outbound HTTP requests using UrlFetchApp.
Slack provides Incoming Webhooks—a lightweight, secure mechanism to post JSON payloads containing formatted messages directly into your designated channels.
+-------------------------------------------------------+
| Google Ads Engine |
| - Executes script hourly via schedule |
| - AdsApp queries campaign cost: 'TODAY' |
+---------------------------+---------------------------+
|
v
+-------------------------------------------------------+
| Script Threshold Engine |
| - Calculates % of daily budget spent |
| - Evaluates current account hour |
| - Flags campaigns exceeding alert thresholds |
+---------------------------+---------------------------+
|
v
+-------------------------------------------------------+
| UrlFetchApp HTTP POST |
| - Formats payload (JSON with Slack blocks/emojis) |
| - Sends POST request to Slack Webhook URL |
+---------------------------+---------------------------+
|
v
+-------------------------------------------------------+
| Team Slack Channel |
| - Displays real-time alert with campaign name, |
| budget, actual spend, and direct campaign link |
+-------------------------------------------------------+
Step 1: Create Your Slack Incoming Webhook
1. Navigate to your Slack workspace's app directory (api.slack.com/apps).
2. Click Create New App From scratch.
3. Name your app Google Ads Budget Sentinel and pick your workspace.
4. Go to Incoming Webhooks in the sidebar and toggle the switch to On.
5. Click Add New Webhook to Workspace at the bottom.
6. Select the dedicated channel where you want notifications posted (e.g., ppc-alerts or marketing-ops) and click Allow.
7. Copy the generated Webhook URL (it looks like https://hooks.slack.com/services/T00/B00/XXXXX). Keep this URL private.
---
The Complete Intraday Spend Alert Script
Below is the complete, production-ready script. It works with standard Search, Display, Video, and Performance Max campaigns inside Google Ads accounts using the modern Google Ads API infrastructure.
javascript
/
• Google Ads Script: Intraday Spend Spike Alert to Slack
• Author: AdTurbo Engineering
• Schedule: Hourly (Recommended: 8 AM - 6 PM account local time)
/
const CONFIG = {
// 1. Paste your Slack Incoming Webhook URL here
SLACKWEBHOOKURL: 'https://hooks.slack.com/services/YOUR/WEBHOOK/URL/HERE',
// 2. Alert threshold: % of daily budget spent before cutoff hour
// 0.70 means alert if 70% of budget is spent early
MIDDAYSPENDTHRESHOLD: 0.70,
// 3. The cutoff hour (24-hour clock) for the midday threshold.
// e.g., 13 = 1:00 PM. If spend 70% before 1:00 PM, triggers alert.
MIDDAYCUTOFFHOUR: 13,
// 4. Critical threshold: alert anytime before 5 PM (17:00) if spend exceeds this %
// 1.00 = 100% of daily budget
CRITICALSPENDTHRESHOLD: 1.00,
CRITICALCUTOFFHOUR: 17,
// 5. Campaign Name Filters (leave empty array [] to check all enabled campaigns)
// Example: ['Brand', 'PMax'] checks only campaigns containing those strings
CAMPAIGNNAMECONTAINS: [],
// 6. Campaign Name Exclusions
CAMPAIGNNAMEDOESNOTCONTAIN: ['Test', 'Paused'],
// 7. Prevent spam: Minimum budget to monitor (avoids alerts on $1/day test campaigns)
MINDAILYBUDGET: 10.00
};
function main() {
const timeZone = AdsApp.currentAccount().getTimeZone();
const currentHour = parseInt(Utilities.formatDate(new Date(), timeZone, 'HH'), 10);
const dateFormatted = Utilities.formatDate(new Date(), timeZone, 'yyyy-MM-dd HH:mm');
Logger.log('Starting Intraday Spend Sentinel at ' + dateFormatted + ' (' + timeZone + ')');
Logger.log('Current Account Hour: ' + currentHour);
// Build Campaign Selector
let campaignSelector = AdsApp.campaigns()
.withCondition('Status = ENABLED')
.withCondition('ServingStatus = SERVING');
const campaigns = campaignSelector.get();
let alertList = [];
while (campaigns.hasNext()) {
const campaign = campaigns.next();
const campaignName = campaign.getName();
// Name Filters
if (shouldSkipCampaign(campaignName)) {
continue;
}
const budget = campaign.getBudget();
if (!budget) continue;
const dailyBudget = budget.getAmount();
if (dailyBudget < CONFIG.MINDAILYBUDGET) {
continue;
}
// Fetch TODAY's performance metrics
const stats = campaign.getStatsFor('TODAY');
const spendToday = stats.getCost();
const spendPercent = spendToday / dailyBudget;
Logger.log('Checking: ' + campaignName + ' | Budget: