2.1K members online now
2.1K members online now
Use AdWords conversion tracking and reporting to measure your results. Have a question about Google Analytics? Post it here, on the Google Analytics Community!
Guide Me

Notification about meeting daily and monthly budget

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi everyone,


I have a quite complicated situation about notifying the budget


In this case: i have a campaign which has the budget of $60 in 1 month


=> daily budget is about $2 a day


I set the actual daily budget for $60 ( policy of the company to set the daily budget = total budget, to get more traffic according to them)


I set the automated sending email to my account when the cost go over $2 in 1 day ( i don't want the cost go over my daily budget) 


The problem here is i want to accumulate the excess amount of each day

For example: day 1 i can spend $2 (daily budget) but i only spend $1 

                     With the above set up i can only get notify when the cost >$2


But i want it to notify me when the cost >2.03, i got 2.03 from 59 (the budget remain) / 29 (the day remain)

The amount maybe small in just 1 or 2 days, but assume that it was 15 days and i have not spend anything


My daily notification will go up from $2 to $4 (60/15), so i can have more control over my campaign

Is there anyway to do this by using the automated email alert?

Thank you guys so much

1 Expert replyverified_user

Re: Notification about meeting daily and monthly budget

Participant ✭ ✭ ☆
# 2
Participant ✭ ✭ ☆
I'm not sure if you could set up such a dynamic email notification because it could essentially change every day. It might be possible with a script. You can always set up a report to email you every day with MTD spend, also. It might be easiest to manage your budget by setting up automated rules to run periodically throughout the month to adjust budget based upon MTD spend.

The very best case scenario, though, (and I know this isn't practical for everyone) would be to log in daily and manually check it. There are so many things that can happen if you don't look at your account for a few days. I would be really careful at setting your daily budget equal to your monthly budget. You could accidentally spend your whole budget - or more - in one day.

Hope this helps!
Marked as Best Answer.
Accepted by topic author Minh Tâm N
September 2015

Re: Notification about meeting daily and monthly budget

Top Contributor
# 3
Top Contributor

Hi @Minh Tâm N the ideal solution for a fixed monthly budget is a script that manages spend to date.  I use one in several of my client Accounts and it works very well.  The complete script is at the end of this message, feel free to use it, ensuring you Preview the script to check it's working as expected before setting it to run.


The script uses two Labels; FlexBudget which identifies the Campaigns that should be affected by the script (it will ignore any Campaigns without this Label), and a Label that indicates the percentage of the budget that should be applied to that Campaign.  So, if you had two Campaigns and wanted them to share the same fixed monthly amount, you could label one 60 and the other 40 and the budget will be split 60/40 between the two.  If you want the script to work with only one Campaign, you must apply a Label named 100.  If you have lots of Campaigns, make sure the Labels all add up to 100 or you'll spend more, or less, than expected.


The script examines the spend of the targeted Campaigns to date, then calculates the remaining spend available for how many days are left in that month.  The script should be run daily at 1am.




/* Flexible Budget Script © Jon Gritton 2015 */

var TOTAL_BUDGET = 60;  //This is your total required spend for the month
var d = new Date(Utilities.formatDate(new Date(), AdWordsApp.currentAccount().getTimeZone(), "MMM dd,yyyy HH:mm:ss"));
var thisMonth=d.getMonth();
var thisYear=d.getFullYear();
// DAYS_SO_FAR is -1 because "today" hasn't happened yet
var DAYS_SO_FAR = d.getDate() - 1;
var TOTAL_DAYS = daysInMonth(thisMonth + 1, thisYear);

var START_DATE = new Date(thisYear, thisMonth, 1);
var END_DATE = new Date(thisYear, thisMonth, TOTAL_DAYS);

function main() {
setNewBudget(calculateBudgetEvenly, TOTAL_BUDGET, START_DATE, END_DATE);

function setNewBudget(budgetFunction, totalBudget, start, end) {
var costSoFar = 0;
var campaignsToSet = [];
var campaigns = AdWordsApp.campaigns()
//affect only live Campaigns
.withCondition("Status = ENABLED")
.withCondition("LabelNames CONTAINS_ANY ['FlexBudget']")
while(campaigns.hasNext()) {
var thisCost = campaign.getStatsFor(dateToString(start), dateToString(end)).getCost();
costSoFar += thisCost;
//get only the labels for percentages
.withCondition('Name IN ["FlexBudget"]')
if(campLabels.hasNext()) {
//this campaign is a Flexbudget
Logger.log("CampaignToSet: " + campaign.getName());
var totalCalcd = 0;
Logger.log("CostSoFar: " + costSoFar);
totalBudget -= costSoFar;
Logger.log("Total available for Flex Campaigns for the rest of the month: " + totalBudget);
for(var i=0;i<campaignsToSet.length;i++) {
var thisCampaign=campaignsToSet[i];
// Ensure only the "percentage" Label is selected - you may need to add others if you use them
.withCondition("Name NOT_IN ['FlexBudget']")
var percentage =;
//set the new budgets
var newBudget = budgetFunction(totalBudget, percentage);
newBudget=(newBudget>0)? newBudget : 1;
Logger.log("Campaign Set: " + thisCampaign.getName() + " Budget: " + newBudget);

function calculateBudgetEvenly(totalBudget, percentage) {
//set budget based upon percentage Label
var budgetRemaining = totalBudget*(percentage / 100);

if (DAYS_REMAINING <= 0) {
return budgetRemaining;
} else {
return budgetRemaining / DAYS_REMAINING;

function daysInMonth(month, year) {
//returns number of days in a given month of a given year
return new Date(year, month, 0).getDate();

function dateToString(date) {
return date.getFullYear() + zeroPad(date.getMonth() + 1) + zeroPad(date.getDate());

function zeroPad(n) {
if (n < 10) {
return '0' + n;
} else {
return '' + n;

AdWords Top Contributor Google+ Profile | Partner Profile | AdWords Audits

Re: Notification about meeting daily and monthly budget

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭
Thank you so much Amy, I also think that it's impossible without a script, because it got so many campaigns that i can't handle it in just one day, so the manually checking method seems to be impossible for me. but i will looking for a way to manage it. Your advices help me a lot. Thank you, have a nice day

Re: Notification about meeting daily and monthly budget

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
Wow, thank you so much John, this script might be a solution for me. I will try to apply it to my campaign. Because I have limited knowledge about programming, so it may take time to use the script effectively. But I will try my best. Thank you a million times John. Have a nice day mate