A guide to AdWords Scripts.

A guide to AdWords Scripts.

AdWords Scripts: Your first steps

Back before 2012 there were two kinds of AdWords Advertisers: those that had API access and the team of developers required to take advantage of it, and those that did not. This precious resource was governed by a usage quota, and that quota was allocated by spend. If you were a small- or medium-sized advertiser your choices were simple: do everything manually or buy a tool. Tools were expensive, and because they worked on commission of spend, achieving profitability on your campaigns was harder as they added 10%–15% to your costs. In 2012 this entire model got quietly flipped upside down, but five years later many advertisers still haven’t fully embraced the awesome power of AdWords Scripts.

AdWords Scripts are a tool within the AdWords interface that opens up most of the functionality of the AdWords API to any advertiser with a working knowledge of JavaScript. If you just got a little bit nervous at the mention of JavaScript, don’t worry. In this post we’ll discuss how a non-technical marketer can get started with AdWords Scripts and how you can borrow and hack your way into scripting like a pro.


Why use scripts?

How many hours in the day do you spend pulling reports? How about finding negative keywords? Writing ads? I have worked this out to about 10–15 hours a week. I have always lived by the lazy man’s mantra: “work smarter, not harder.” And it turns out that this is also fantastic advice for saving lots of money and being much more successful in AdWords. Automation allows you to free up time to use on the tasks that really matter in your account. They let you work on the bigger strategic questions or focus your energy sourcing new keywords or writing ads. They allow smaller agencies to handle much larger accounts, and larger agencies to save money in ad operations.

The beautiful thing about code is that it’s consistent. It’ll run the same way every time. Your code never has an off day, never experiences coffee withdrawals or commute worries. If your code is right, it will continue to be right until Google makes an API update that affects it. This consistency, speed, and accuracy has allowed us to see major improvements in performance. Accounts that have been updated with a suite of automation scripts have seen a 15%–20% reduction in cost per action (CPA).


It’s not as hard as it looks.

If you’re starting with AdWords Scripts for the first time, it’s easy to feel overwhelmed. As you open up your first script, you are greeted with a blank canvas and “function main().” If you have no background in JavaScript, and no help, you may want to just close your screen and move on. The good news is that it’s much easier than it looks.

You can think of your AdWords Scripts as a bit like a LEGO set. A set of LEGO bricks typically comes with a booklet on how to build the supercool spaceship that you bought. However, anyone with an imagination knows that the directions are really just a suggestion. Similarly, snippets of code in AdWords Scripts can be thought of as the building blocks that get you to a workable solution. This means you can:


Build the supercool spaceship.

If you’ve never used AdWords Scripts before, you probably want to just stick with what’s written on the instructions. There are a ton of out-of-the-box solutions available all over the web. My personal favorite resources to get started are:

  • Official AdWords Scripts Documentation
    There are over 100 scripts available in the Resources section of AdWords that cover everything from pulling various reports to integrating with Twitter. I tend to prefer when I can get my information directly from the source, and there isn’t anything more direct than Google itself.
  • FreeAdWordsScripts.com
    Russell Savage at FreeAdWordsScripts.com used to update this site regularly but has been MIA since mid-2015. However, there are still quite a few nuggets of gold. I have especially gotten quite a bit of use out of his ad testing script (though it needs some tweaking of expanded text ads).
  • “100 Google AdWords Scripts You Should Be Using”
    A really great post from Koozai with 100 scripts curated from the web. This is all stuff that you could find yourself, but it’s nice to have it all in one place.
  • Optmyzr
    If you have some money burning a hole in your pocket, you can take a look at Optmyzr. They’ve built a pretty cool solution that bridges the gap between a paid platform and going it alone with scripts.

With any of these resources you should be able to find something that comes close to solving any problem you run into. In most cases you can copy and paste the code directly into your account and press “run.” Most of these scripts are pretty well commented, so any editing that needs to be done is as simple as following the directions. However, it’s worth taking the time to go through any code you install in your account to understand what it’s doing and how it’s doing it. Not only will this let you better understand how to build your own scripts in the future, it’ll also help you ensure that there isn’t anything funky happening—that is, anything in the script that you might not want running in your account.


Build a robot.

Have some experience working with canned scripts and a good sense of how these scripts are doing what they’re doing? Then you’re ready to start experimenting. You can start to take bits and pieces from your other solutions and put them together to solve other problems you might have.

For example, let’s say that you’re currently running a script that pulls an ad performance report and dumps the data into a spreadsheet in Google Sheets. This is a fairly simple script that should have three parts: (1) Getting the data from a report, (2) structuring the data to write to a spreadsheet, and (3) writing the data to a spreadsheet. Now, if you want to try to pull a different report or write a different set of data to a spreadsheet you have the code you need to accomplish the task. Simply copy the relevant piece of the code into the new script. The more scripts you write, the larger your toolbox will be to pull from.


Build whatever you want.

Now you likely have 10 or 12 scripts in your account that are automating all of those annoying little tasks that would take up your time every day. You may start to realize that it’s actually pretty easy to start doing this from scratch now that you understand how these scripts work. As you start, remember these two virtues:

Planning. Don’t start writing until you have a basic idea of what the final script is going to look like. Are you going to pull the data from a report or use the “GetStatsFor();”? Is the dataset going to be too large for a spreadsheet? The worst thing you can do is get halfway through your script only to realize that you either can’t or don’t know how to do what you’re trying to do.

Persistence. Writing scripts can very frequently feel like you just ran full speed into a brick wall. You’ll be humming along nicely, feeling pretty proud of yourself only to find that your code won’t run or doesn’t actually do what you want it to do. After debugging your code over and over to little success, it is very tempting to just give up and find another solution. I have found that the best way to combat this is to get away from the code for a while and let the problem simmer on the back burner for awhile. It’s very easy to become blinded to obvious problems, and approaching your project with fresh eyes really helps you break through these kinds of roadblocks.

The best way to learn scripts is to get some experience. You can run anything you do in “preview” mode to ensure that nothing you do is going to have a negative impact on the account, so you have nothing to lose.


Good luck!