Home » SEO » Four Ways You Can Benefit By Using AdWords Scripts

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: Enterprise SEM | Google: AdWords

scroll to top