Four Ways You Can Benefit By Using AdWords Scripts

The best kept secret for saving time and improving results in AdWords may very well be AdWords Scripts, a lightweight automation tool that is easier to use than the API but more powerful than the standard interface and the AdWords Editor.

As highly as I think of the AdWords UI (I helped build it for 10 years, after all), when I recently started working with accounts of big advertisers, I found myself frustrated at how manual, repetitive, and slow it was to generate custom reports and act on my findings.

The API could let me automate to my heart’s content, but getting started meant waiting for Google to review my application for access and then working with engineers to build the desired functionality. I wanted something that would make me more efficient right away, so I turned to AdWords Scripts.

AdWords Scripts Have A Few Key Benefits

  • Just like Google Apps Scripts, they use JavaScript, a language that’s easy to learn and has tons of free support and documentation online
  • They come with a slew of built-in functions to interact with common structural elements like accounts, campaigns, ad groups, keywords, and ads so you don’t need to spend time figuring out how to write this code, and you can just focus on adding your business logic
  • Scripts can be scheduled to run automatically, as often as hourly or as little as once per month, making it possible to automate frequent tasks
  • They can be integrated easily with other Google services like Gmail or spreadsheets making it easy to create a workflow that is customized to your needs

If you’re worried that creating an AdWords Script will be too hard, fear not! Google has included several fully functional scripts in their documentation and some of these may even be the complete solution to one of your problems.

I was able to get started by making small tweaks to example scripts and slowly learning the full range of capabilities. Look at how few lines of code are needed in this example from Google to increase bids for keywords that are performing well:

AdWords Scripts Example

Sample code for increasing keyword bids

This example doesn’t do anything you can’t achieve with an Automated Rule so here are a few ways that Scripts let you go above and beyond the standard capabilities of the AdWords UI:

  • Email a list of recommended action items whenever a script’s analysis uncovers a new opportunity. For example, when it finds ad groups with only one ad variation, email the person in charge of ad texts that they should test another variation in those ad groups.
  • Add data to a Google Spreadsheet where it incorporates some of your own business logic. For example, based on ROI goals, create a spreadsheet that highlights underperforming ad groups in red and sorts them from biggest to smallest opportunity.

Below are a few more detailed examples of problems I’ve solved with AdWords Scripts.

1.  Create A Historical Quality Score Report


If you’re going to try to improve Quality Score (QS) in an account, there are two things you’ll need that AdWords reports don’t give you: a way to monitor progress and a way to prioritize which keywords, ads, and ad groups to prioritize. Normally, when tackling this type of problem, it involves a lot of manually created pivot tables.


Build an AdWords Script that steps through every keyword in the account and collects the data about QS and impressions. (Side note: if an account has too many keywords and causes the script to time out, limit it to look at only the highest volume campaigns.)

Once you have all the keyword data, use it to calculate impression-weighted QS values for each ad group as well as the account-level QS.

Here’s a simple example of the math to get the weighted QS of an ad group: determine what percentage of an ad group’s impressions go to each keyword and then multiply this by that keyword’s QS. Add up all the weighted QS numbers to get the ad group level QS.

How To Calculate Impression Weighted Quality Score

How To Calculate Impression Weighted Quality Score

Then, the script pushes all the data into a Google Spreadsheet. When you schedule it to run daily, you will have a historical record of QS. And, with just a few additional tweaks to the script, you can even get the names of ad groups that are prime candidates for an optimization.

Historical Quality Score Chart

Build A Historical Quality Score Chart With AdWords Scripts


2.  Find Keywords That Are Underperforming After An Optimization


After doing an account restructure, you’ll want to know if there are keywords that are performing worse than before the change. Because the keywords have been moved to new ad groups, it’s hard to use the AdWords interface to compare the performance without jumping back and forth between different ad groups or without doing a whole bunch of vlookups in a spreadsheet.


Rather than manually matching up rows in two reports, our script does it for us. Tell the script the name of the new campaign and the old campaign and the date ranges for which to compare metrics.

It then gets the data for each keyword across the selected campaigns for the two specified date ranges and outputs the combined totals to a spreadsheet where you can quickly compare the performance before and after the optimization.

Rather than it being a chore, now it’s easy to check in on an optimization more frequently to find out if further tweaks are needed.

3.  Automate Account Health Checkups


This being the start of a new year, you’ve probably seen a few articles that suggest now is a great time to check up on the health of your account. But why do this only once per year? If you manage your account actively, there are probably portions that get out of shape all the time, and it’d be useful to know about these opportunities more frequently.


Build a script that analyzes account structure. It steps through an entire account and counts the number of keywords, the individual keyword match types, ads and ad groups. Based on triggers that you choose, like the minimum and maximum allowed ad texts per ad group, the script sends an automatic email about account elements that fall outside these boundaries. For example, when it finds an ad group that has more than 20 keywords, it sends an email reminding the team to split this into multiple ad groups.

4.  Automate Actions For Which No Bulk Action Exists


When Google determines an ad is not performing as well as the other variations and starts to serve it less, we like to get rid of that ad and replace it with a new variation to challenge the top performing ad. You can do this by looking for the ad with the lowest percentage served in every ad group.

Unfortunately, there is no report that returns just the lowest performers across an entire account, and even if this existed, you wouldn’t want to delete a low performing ad if it was the last one in an ad group.

We need a solution that analyzes individual ad groups and incorporates some business logic for how many ads we want to keep in each ad group.


Build a script that evaluates every ad group individually by analyzing all ad variations’ metrics for percentage served, CTR and conversion rate. Delete or pause the ad with the lowest percentage served but not if that ad’s performance is within 10% of other variations and not if the ad is contributing a larger than expected number of clicks or conversions.

Of course, the script should also not remove the ad if that would leave the ad group with no active ads. If you want to take a look at what the script will do before applying the changes for real, add a switch to run the script in test mode where it reports what it will change before making the change.

These are just a few of the ways I’ve put AdWords Scripts to work on my accounts, allowing me to focus on the things that can’t be automated.

Opinions expressed in the article are those of the guest author and not necessarily Search Engine Land.

Related Topics: Channel: SEM | Enterprise SEM | Google: AdWords


About The Author: is the founder and Chief Marketing Technologist of Top Tier Marketing, an online marketing agency specializing in AdWords. He is also the Cofounder of Optmyzr, an AdWords tool company that makes account management more efficient. Prior to forming Top Tier, Vallaeys spent 10 years building AdWords and teaching advertisers how to get the most out of it as the Google AdWords Evangelist.

Connect with the author via: Email | Twitter | Google+ | LinkedIn


Get all the top search stories emailed daily!  


Other ways to share:

Read before commenting! We welcome constructive comments and allow any that meet our common sense criteria. This means being respectful and polite to others. It means providing helpful information that contributes to a story or discussion. It means leaving links only that substantially add further to a discussion. Comments using foul language, being disrespectful to others or otherwise violating what we believe are common sense standards of discussion will be deleted. Comments may also be removed if they are posted from anonymous accounts. You can read more about our comments policy here.
  • smichaelgriffin

    Great info – especially tip #2. I’ve just started exploring scripts and look forward to trying out your ideas!
    Only thing I’d add: for us script-beginners it’s helpful to know where add/edit them.
    (In the Campaigns tab under “Bulk Operations”)

  • Pat Grady

    Smart people in my ecosystem, smarter than me. Very healthy situation!

  • Rajesh Magar

    Great article of-course. But my self is quite newbies with these topic “Adword Script” . So could you list some of great resources to star with will be more appreciate.

  • Jerry Nordstrom

    Great topic and very useful information @Frederick. 10 years building AW, so you were there from the start – You’re a fantastic resource here at SEL.

  • Auke Jongbloed

    For me quality score is an real important metric so the first tip is spot on! Thanks for that. I am not a real developer I must say and I am hoping you could get me on the right track in finding out how I can build a script like you mention.

    I have trouble in finding out how I can build a spreadsheet witch keeps old data instead of overwriting the old data. For now I have only one day worth of data…

    Maybe you could get me in the right direction where to find my answers in writing a great script for historical QS score.



  • Auke Jongbloed

    I have found this great post about tracking keyword quality score. It is a bit different but still a good starting point. It is a post from Martin Roettgerding, head of SEM at agency Bloofusion Germany. He wrote the next post:

  • Russell Savage

    I run the blog that has many examples of what you can do with AdWords Scripts. I am always looking for new ideas for scripts so if you stop by in the next few days, i may have some of these examples up and running.

  • Christian Bullock

    So, the Quality Score script… care to share? :)

  • Роман Рыбальченко

    Link doesn’t work (

  • Ayman Albarbary

    Link is dead

  • Joel Chudleigh

    Great article Frederick – to be honest a lot of PPC articles on SEL have been a bit fluffy of late and you have turned that around big time. This is actionable and holds great time saving and performance improving opportunities – thanks.


Get Our News, Everywhere!

Daily Email:

Follow Search Engine Land on Twitter @sengineland Like Search Engine Land on Facebook Follow Search Engine Land on Google+ Get the Search Engine Land Feed Connect with Search Engine Land on LinkedIn Check out our Tumblr! See us on Pinterest


Click to watch SMX conference video

Join us at one of our SMX or MarTech events:

United States


Australia & China

Learn more about: SMX | MarTech

Free Daily Search News Recap!

SearchCap is a once-per-day newsletter update - sign up below and get the news delivered to you!



Search Engine Land Periodic Table of SEO Success Factors

Get Your Copy
Read The Full SEO Guide