var dBudget = 20;
var EMAIL = "na...@domain.com";
function main() {
var totalSpend = 0;
var camps = AdWordsApp.campaigns()
.withCondition("Status = ENABLED")
.get();
while(camps.hasNext()) {
var thisCamp = camps.next();
var thisSpend = thisCamp.getStatsFor("YESTERDAY").getCost();
totalSpend += thisSpend;
}
Logger.log("Total Spend: €" + totalSpend);
if(totalSpend > (dBudget * 1.5)) {
doSendEmail(totalSpend);
Logger.log("Email warning sent.");
}
}
function doSendEmail(totalSpend) {
var body = "AdWords Campaigns have spent €" + totalSpend + " last day.";
MailApp.sendEmail(EMAIL,"Daily budget exceeded by more than 50%", body);
}
Sometimes overdelivery can be a good thing. For example, think about sudden spikes in user queries for your product because of a television show. You probably wouldn't want to mis out on the revenue potential because your campaign is limited by budget.
My suggestion would be to always keep a close eye on what is happening and adjust budgets when necessary.
For those interested, i decided to create a script that monitors these exact fluctuations.
The script will compare the anticipated ad spend based on your campaign daily budget settings with the actual ad spend.
It will check for overdelivery in any of three periods: yesterday, last week and last month.
In case of big differences (overdelivery by Google) it will report an alert, log the alert in the specified Google Sheet and inform you about the alert via email.
Here's the script:
A Script to receive Daily Budget Overdelivery Alerts
Hope this helps
Nils