I have a client that work on sun till thu
the campaign run with the same budget for each day,
but a week ago he said that he get more leads and phone calls on Sunday and Thursday, more than he wants,
and less than he wants of the other days.
His budget was 600$ a week, so,
instead of using 20% of the weekly budget every day,
we change it to 13% on Sunday and Thursday, (12.5% * 600 = 75)
and 25% on the other days ( 600 * 0.25 = 150 )
It was easier for me to that, but of course I could write specific numbers instead.
I prefer variables instead of numbers, because that way if I want to change something,
I only need to change the var, instead of searching it all over the script.
well, I've said enough. let's play:
function main() {
/* Change campaign name to your campaign name */
var campaignName = "main";
var Weekly_Budget = 600;
var SuThu_BUDGET = Weekly_Budget * 0.125;
var MoTuWe_BUDGET = Weekly_Budget * 0.25;
var d = new Date();
var n = d.getDay();
var campaignsIterator = AdWordsApp.campaigns()
.withCondition("Name = '" + campaignName + "'")
.get();
if (campaignsIterator.hasNext())
{
var campaign = campaignsIterator.next();
/* 0 means sunday, 4.0 means thursday */
if ((n=0)||(n=4.0))
{
campaign.setBudget(SuThu_BUDGET);
} else
{
campaign.setBudget(MoTuWe_BUDGET);
}
}
}