Here is the script that will help you stay within your daily budget. Again this is not a sure-shot method but will give you some peace. Also, I have created a rule which is if the spend is above X$ then send me an email, this way I have full control before the script kicks in
function main() {
var allowedOverdeliveryPercentage = 0.3; // set percentage as decimal, i.e. 20% should be set as 0.2
var labelName = “paused by overdelivery checker script”;
AdWordsApp.createLabel(labelName, “automatic label needed to reenable campaigns”);
var campaigns = AdWordsApp.campaigns()
.withCondition(“Status = ENABLED”)
.withCondition(“Cost > 0”)
.forDateRange(“TODAY”);
var campaignIterator = campaigns.get();
while (campaignIterator.hasNext()) {
var campaign = campaignIterator.next();
var campaignName = campaign.getName();
var budgetAmount = campaign.getBudget().getAmount();
var costToday = campaign.getStatsFor(“TODAY”).getCost();
if(costToday > budgetAmount * (1 + allowedOverdeliveryPercentage)) {
Logger.log(campaignName + ” has spent ” + costToday + ” which is more than allowed.”);
campaign.applyLabel(labelName);
campaign.pause();
} else {
Logger.log(campaignName + ” has spent ” + costToday + ” and can continue to run.”);
}
}
}