Try it
Shows a worked example of the output, not a run against your account.
dataLayer
Nothing yet
Google Ads Script (JavaScript)
/**
* Goodlabs Google Ads script: budget pacing alerts
* Schedule: Daily at 08:00
*/
var CONFIG = {
MONTHLY_BUDGET: 5000,
ALERT_EMAIL: "media@yourdomain.com",
MAX_OVERPACE_PERCENT: 15
};
function main() {
var now = new Date();
var totalDays = new Date(now.getFullYear(), now.getMonth() + 1, 0).getDate();
var currentDay = now.getDate();
var daysRemaining = totalDays - currentDay;
var campaignIterator = AdsApp.campaigns()
.withCondition("Status = ENABLED")
.get();
var mtdSpend = 0;
while (campaignIterator.hasNext()) {
var c = campaignIterator.next();
var stats = c.getStatsFor("THIS_MONTH");
mtdSpend += stats.getCost();
}
var dailyAverage = currentDay > 0 ? (mtdSpend / currentDay) : 0;
var projectedTotal = mtdSpend + (dailyAverage * daysRemaining);
var diffPercent = ((projectedTotal - CONFIG.MONTHLY_BUDGET) / CONFIG.MONTHLY_BUDGET) * 100;
Logger.log("MTD Spend: $" + mtdSpend.toFixed(2) + " | Projected: $" + projectedTotal.toFixed(2) + " (" + diffPercent.toFixed(1) + "%)");
if (Math.abs(diffPercent) > CONFIG.MAX_OVERPACE_PERCENT && CONFIG.ALERT_EMAIL) {
MailApp.sendEmail(
CONFIG.ALERT_EMAIL,
"🚨 Google Ads Pacing Alert: " + (diffPercent > 0 ? "Overpacing" : "Underpacing") + " by " + diffPercent.toFixed(1) + "%",
"Current MTD Spend: $" + mtdSpend.toFixed(2) + "\n" +
"Projected Month-End Spend: $" + projectedTotal.toFixed(2) + "\n" +
"Target Monthly Budget: $" + CONFIG.MONTHLY_BUDGET + "\n\n" +
"Recommended adjusted daily budget: $" + ((CONFIG.MONTHLY_BUDGET - mtdSpend) / Math.max(daysRemaining, 1)).toFixed(2)
);
}
}How it works
- Calculates daily budget targets based on total monthly allowance and days in the current month.
- Projects month-end spend using Month-to-Date (MTD) totals and recent daily burn velocity.
- Measures percentage variance between projected spend and target budget.
- If pacing deviation exceeds ±15–20%, sends an automated email notification with adjusted daily cap recommendations.
Step-by-step installation
- Create a new script in Google Ads Tools & Settings > Scripts.
- Enter your MONTHLY_BUDGET and notification email.
- Schedule to run daily at 08:00 AM.
Frequently asked questions
Does this modify campaign budgets automatically?
By default, it only alerts via email to prevent unexpected changes. You can enable automatic budget adjustments if desired.