Wednesday 11 September 2013
Balancing Budgets with Scripts
We all know that AdWords budgets should be led by your Return on Investment. If your AdWords Campaigns are returning a net profit you should be spending as much as is possible so that all your Campaigns hit a 100% Impression Share to maximise the chance of conversions. However in some cases, for one reason or another, a client may request that you adhere to a fixed budget per month so it's possible you could be faced with multiple Campaigns, all of which are "Limited by Budget". So, if you can't give the Campaigns the budget they deserve and you can't persuade the client to increase the budget, what can you do?
I was faced with this situation recently when building a new Account structure for a client. They have a wide range of products and even just selecting the top five best sellers left me with all of the Campaigns limited by budget. No matter how I juggled their allocated portions of the budget, no matter how I reduced CPC or paused Keywords I couldn't give any of the Campaigns a decent share without reducing the others to a budget too small to be worth running. Since this was a new structure, all I really needed to do was give each Campaign a fair chance to perform over a period. I considered using Automated Rules to change budgets on a daily basis but you can only do this on specific days: I could give CampaignA a high budget on a Monday, CampaignB a high budget on a Tuesday and so on, but this wouldn't test CampaignA's potential performance on the other days of the week. What I wanted was an automatic way to rotate the "high budget allocation" evenly through all the Campaigns over the course of a month. By the end of that period, I should have enough data to know which Campaigns were performing and be able to apply budgets more sensibly.
Scripts and Google Docs to the rescue!
One of the most powerful features of AdWords Scripts is that they can access a Docs Spreadsheet and read data from the cells therein. So I prepared a spreadsheet with my Campaigns in the first column and the days of the month (1-31) to the right. In each cell I allocated a budget for the day for each Campaign. Using this system I was able to say that CampaignA has a high budget on certain dates rather than specific days of the week. As the month progresses (so long as your changes aren't on a 7-day cycle!) the Campaigns should receive their "high budget allocation" on different days of the week.
The full code for this script is at the bottom of this post, along with a link to a spreadsheet template you can use.
Once you've grasped the idea of using external spreadsheets, other opportunities come to mind. You could replicate the idea of varying budgets by day of the week. This is possible in Automated Rules but it's a lot easier to edit and set up the budgets when you can see them all laid out in a spreadsheet. You could pause or enable Campaigns, Groups or Keywords depending on any schedule you fancy, again, much more easily read through a spreadsheet than by rules and you can run Scripts as many times a day as you like.
There are some great ideas on the Scripting Documentation pages and the Preview Option makes it easy (and safe) to test your ideas before you apply them to your Account.
So, here's the full script for my "High Budget Allocation". You are welcome to copy this script and use it or modify it as you see fit but please bear in mind I hold no responsibility for any actions you take and you must always test the results before applying them to your Account. Scripts are very powerful and issue no warnings so it's vital you test thoroughly before running live and check your Account immediately after a few test runs to make sure the results are what you expect.
function main() {
var NUMCAMPAIGNS=7; //this number needs to be +1 on your actual # of Campaigns
var spreadsheetUrl = "SPREADSHEETURL"; //enter your spreadsheet URL here.
var budgetSheet = SpreadsheetApp.openByUrl(spreadsheetUrl).getActiveSheet();
var range = budgetSheet.getRange(1, 1, NUMCAMPAIGNS, 35);
var values = range.getValues(); // this is now a 2d array with the data in it.
//get the day of the month as an integer and add 1 for first two columns offset
var d = new Date();
var dayMonth = d.getDate();
var chooseDay=Number(dayMonth)+1;
setBudgets(values,chooseDay,NUMCAMPAIGNS);
}
function setBudgets(values,chooseDay,NUMCAMPAIGNS) {
//loops througn values (spreadsheet rows) setting Campaign Budgets
//NOTE: only lists *changes* - if the budget is already at the specified value it isn't set.
var i=1;
while(i<(NUMCAMPAIGNS)) {
var campaignName=values[i][0];
var budget=values[i][chooseDay];
var campaign = AdWordsApp.campaigns().
withCondition('CampaignName = "' + campaignName + '"').
get().
next();
campaign.setBudget(budget);
i++;
}
}
A template spreadsheet you can use is here. Please make a copy of this spreadsheet within your own Drive and then make sure you share it with the Account running AdWords. You'll need to replace the Campaign names with your own and set your own budgets before testing.
It's too early to tell if my experiment will work, but at least I had fun making this script.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment