Production-ready prompts, scripts, frameworks and AI agents for Google Ads professionals. No payment required.
A simple “set and forget” agent. It checks all enabled campaigns, finds ones limited by budget, and emails you a morning summary with recommendations.
var CONFIG = {
EMAIL_RECIPIENTS: ['you@company.com'],
LOOKBACK_DAYS: 7,
SPREADSHEET_URL: 'CREATE_NEW',
};
function main() {
var campaigns = getEnabledCampaigns();
var limited = findBudgetLimited(campaigns);
if (limited.length === 0) {
Logger.log('No budget-limited campaigns found.');
return;
}
var report = buildReport(limited);
sendEmail(report, limited.length);
logToSheet(limited);
}
function getEnabledCampaigns() {
var results = [];
var iter = AdsApp.campaigns()
.withCondition('Status = ENABLED')
.withCondition('Impressions > 0')
.forDateRange('LAST_7_DAYS')
.get();
while (iter.hasNext()) {
var camp = iter.next();
var stats = camp.getStatsFor('LAST_7_DAYS');
var budget = camp.getBudget().getAmount();
var avgSpend = stats.getCost() / CONFIG.LOOKBACK_DAYS;
results.push({
name: camp.getName(),
budget: budget,
avgDailySpend: avgSpend,
utilizationPct: (avgSpend / budget * 100),
impressionShare: stats.getSearchImpressionShare(),
clicks: stats.getClicks(),
conversions: stats.getConversions(),
cost: stats.getCost(),
});
}
return results;
}
function findBudgetLimited(campaigns) {
return campaigns.filter(function(c) {
return c.utilizationPct >= 95;
}).sort(function(a, b) {
return b.conversions - a.conversions;
});
}
function buildReport(limited) {
var lines = ['BUDGET-LIMITED CAMPAIGNS (' + limited.length + ')\n'];
lines.push('Campaign | Budget | Avg Spend | Utilization | Lost IS (Budget)');
lines.push('---------|--------|-----------|-------------|----------------');
limited.forEach(function(c) {
var lostIS = c.impressionShare ?
(100 - parseFloat(c.impressionShare)).toFixed(1) + '%' : 'N/A';
lines.push(
c.name + ' | $' + c.budget.toFixed(2) +
' | $' + c.avgDailySpend.toFixed(2) +
' | ' + c.utilizationPct.toFixed(0) + '%' +
' | ' + lostIS
);
});
lines.push('\nRECOMMENDATIONS:');
limited.forEach(function(c) {
var suggested = Math.ceil(c.avgDailySpend * 1.2);
lines.push('• ' + c.name + ': Increase to $' + suggested + '/day (+20%)');
});
return lines.join('\n');
}
function sendEmail(report, count) {
var subject = 'Daily Budget Check: ' + count + ' campaigns limited';
CONFIG.EMAIL_RECIPIENTS.forEach(function(email) {
MailApp.sendEmail(email, subject, report);
});
}
function logToSheet(limited) {
var ss;
if (CONFIG.SPREADSHEET_URL === 'CREATE_NEW') {
ss = SpreadsheetApp.create('Budget Check Log');
Logger.log('Sheet: ' + ss.getUrl());
} else {
ss = SpreadsheetApp.openByUrl(CONFIG.SPREADSHEET_URL);
}
var sheet = ss.getActiveSheet();
if (sheet.getLastRow() === 0) {
sheet.appendRow(['Date', 'Campaign', 'Budget', 'Avg Spend', 'Utilization %', 'Conversions']);
}
var today = new Date().toISOString().split('T')[0];
limited.forEach(function(c) {
sheet.appendRow([today, c.name, c.budget, c.avgDailySpend.toFixed(2), c.utilizationPct.toFixed(0), c.conversions]);
});
}
Run daily at 9:00 AM so you get the report at the start of your workday.