If you’ve been using AdWords scripts for any substantial period of time, your account may feel like this messy bookshelf.
There are unfinished scripts everywhere. Some scripts were added by the guy who left the company a few months ago, others by your intern who was curious and started tinkering around before she left for the summer.
There are more unnamed scripts than named ones. You may start to think it’s an allegory for your life. Maybe you should bring that up with your therapist next time.
That’s always the problem with any system that grows up organically over time. If you’re not careful, you will end up with something that is impossible to maintain. Tomorrow, you come into work and a script breaks in one of your 300+ accounts. You have no idea how to find it. Logging in and out of accounts can eat up hours of your time in a week.
But you can stop (or at least slow) the process with a little bit of vigilance and planning. Today, I’ll walk through three techniques you can use to help lower the long-term maintenance of scripts in your accounts.
The first thing to do is to take an inventory of all the scripts you currently have running in your accounts. Some will be extremely customized to a specific account and some will be generic. That’s okay; collect all of them anyway.
If you were developing scripts before the advent of MCC scripts, you probably have the same script copied into multiple accounts. Of course, that means you also have the same bug copied into multiple accounts as well. Bringing scripts like this into the MCC level means that there is a single piece of code to look at when debugging an issue.
This also promotes the discipline of writing generic, reusable code that can be applied to many accounts. It may take a little longer to think through and write the script, but in the long run, it will be worth it when you start amassing hundreds of accounts.
If it turns out you have many more specialized scripts that seemingly can only be run in specific accounts, you may want to look closely and understand if any of them can be made more generic by using configuration parameters or making small changes to the code.
Here is some generic code you can use at the MCC level to start running your scripts across multiple accounts using labels.
This code will run through all your accounts and search for the ones labeled with the name used in the SCRIPT_LABEL variable. When you schedule this script to run daily, it will process all accounts with that label up to MAX_ACCOUNTS, which is the maximum number of accounts you can run the executeInParallel() function on.
You can schedule this code to run once per day if you have less than MAX_ACCOUNTS accounts that you want to run a single script on. For really large accounts, you can schedule the script to run hourly and set the value of RUN_HOURLY to true.
Now the script will look for the label named SCRIPT_LABEL-HOUR, so when this script runs at 6pm, it will look for all the accounts with the label “GenericScript-18″. Group your accounts into batches of MAX_ACCOUNTS so that the first set has the label “GenericScript-1″, then next one “GenericScript-2″, and so on. Using this method, you could run any script on up to 1200 accounts in your MCC.
You should replace the GenericScriptFunction() with your specific generic script code that you collected earlier. Be sure to rename the main() function into something unique, since there can be only one main function per script. Then add that name function to the executeInParallel call as well.
You should repeat this process for each generic script you need to run across multiple accounts. When you are finished, you will have a bunch of scripts in your MCC that are scheduled to run either once per day or hourly.
The next step would be to apply the label names to the accounts you want the script to run on.
After speaking at SMX East a few weeks ago, I was asked how I test my scripts. I think the best way to keep your production accounts safe from script bugs is to open a brand new MCC account and create test accounts underneath it.
Since most of my stuff is pretty experimental, most of my accounts are test accounts. This set of test accounts and the MCC is where you will do all of your experimenting and testing for new scripts.
You will need to fill these accounts with Keywords, Ads, and default bids (using scripts probably), but they can be anything since these accounts will never be live. In fact, you probably don’t even want to add any billing information just to ensure these never see the light of day.
Now all your Unnamed and half finished weather scripts have a place to live that won’t clutter up your main MCC. If your intern wants to experiment, they can play around as much as they want in here. Also, if you are working with an agency to build out new scripts, you can give them access to this account without losing any sleep.
In software development, code reviews are an essential part of pushing code into production. The idea is similar to having someone else proofread your writing. Since they are unfamiliar with the writing and topic, they will be objective and find issues or code bugs that you may have missed.
Sit them down, walk them through your logic and thought process for the script, and run the script with them on your test accounts. You may even find a few bugs yourself just by walking someone else through your code.
Scripts have come a long way in the past few years. They have matured into something that I believe most people should be using in their accounts.
Taking a step back from the day-to-day and looking at the overall processes and strategy of creating and deploying these scripts can be a valuable way to keep your account from turing into a maintenance nightmare.
Remember that you may not always be around to look over things. Organizing and documenting a process for your scripting madness gives the next account manager one less thing to talk to their therapist about.
The post Keep Your AdWords Scripts Maintainable With These 3 Tips appeared first on Search Engine Land.