Skip to content

How to use automated rules and scripts in Google AdWords

Published on:

Jonathan Ellins

Lead Technical Strategist

AdWords automation

Managing a Google AdWords account can be a time consuming process. Using automated rules and scripts on AdWords can help save optimisation time and also can highlight important issues.

What are AdWords automated rules and scripts?

Both automated rules and scripts allow you to control the AdWords account at regular periods, set times or when requested. Below are the main features for automatic rules and scripts:

  • Bids can be adjusted based on historical data
  • Keywords, ads, ad groups or campaigns can be automatically enabled or paused 
  • Results and changes can be reviewed before implementing
  • Reports can be automatically generated and emailed about any changes made


How can automated rules or scripts help optimise an AdWords account?

Letting areas of an AdWords account run on autopilot can be a daunting prospect for some online advertisers, but it has some key advantages, especially on larger accounts or for those with limited time:

  • Wasted ad spend can be automatically identified and dealt with – For example, an irrelevant keyword which is costing more than it gets in return could be automatically paused or toned down
  • Top performers can be boosted to increase profitability – For example, a top performing keyword which was getting a higher than expected return on ad spend could have it’s maximum cost-per-click raised so its ad position is raised up and it receives more clicks and sales per day
  • Special changes during different times of the day, week, month or year can be planned for ahead of time and launched exactly when needed – For example, weekend-only offer adverts could be automatically triggered at midnight on a Friday and paused again at midnight on Sunday during out of office hours
  • More clicks can be gained out of a limited daily budget For example, a keyword’s ad position can be tweaked as low as possible to get the most number of clicks from a limited ad spend whilst still spending the full daily budget
  • Analytics reports on the account can be automatically sent each day, week, month or when required – For example, you may wish to send a business owner an automatic email at the start of each month with a list of the top converting keywords from the past month


What’s the difference between automated rules and scripts?

Automated rules are very easy to set up without the need for development, yet they are limited in what they can achieve. Alternatively, AdWords scripts can be complicated to develop, but they offer great flexibility and increased precision for bidding strategies and reporting.

If you are new to AdWords automation then always start with automated rules to begin with and take experience and knowledge from that tool in to your future AdWords Scripts.


How to set up an automatic rule

To start setting up an automatic rule you first need to decide which level you want to automate:

  • Campaign Level
  • Ad Group Level
  • Advert Level
  • Keyword Level

You then need to view the campaigns, ad groups, ads or keywords which you wish to set an automatic rule upon and tick the boxes next to items to which you want to apply the rule (or leave them all unticked if you wish to select them all at once):

Example showing individual keywords being selected
Example showing individual keywords being selected

Now find the “Automate” drop down and select the rule output from the typical choices shown below:

  • Change Bids When…
  • Pause Items When…
  • Enable Items When…
  • Send Email When…
Dropdown options for automatic rules

Now you can set the automatic action, the requirements the item has to meet to be changed and how frequently the rule will be applied:

Automatic Rule options for pausing keywords
Automatic Rule options for pausing keywords (default unused view)

You can add as many requirements as needed, and if changing bid amounts, you can set an optional maximum bid so that bids never go above a certain level. In the example below, bids are raised by 10% each Monday at 2AM if the cost-per-conversion is under £20 during the past 30 days, and as long as there has been over 100 clicks with at least 3 converted clicks:

Automatic rule options for changing max. CPC bids (10% increase, cost per conversion under £20, clicks 100 or over, conversions 3 or over, weekly change at 2AM on Monday, using past 30 days of data)

Pressing “Preview results” allows you to see what changes will be applied if the automatic rule ran at this very moment. This will help you make sure that the results are in line with what you expected:

Always preview the results before saving to ensure it's working correctly
Always preview the results before saving to ensure it’s working correctly

If you ever need to review or edit and Automatic Rules, they can be found within the “Bulk Operations” section of AdWords in the left-hand column:

How to review and edit all the automated rules currently setup
How to review and edit all the automated rules currently setup


How to set up an AdWords script

scriptsAdWords scripts are code written in simple JavaScript language. They allow access to all major areas of AdWords and have the ability to draw data from external sources and write data to Google Spreadsheets.

As you can write AdWords scripts in a programmable language, they allow you to compare data, run custom calculations, filter information and report on what matters to you. Scripts can even create new campaigns, ad groups, product groups, etc. in AdWords automatically so they can be used to build accounts, as well as change and report on them.

It may seem daunting at first, but script functions are written in plain English and are actually quite easy to use if you start from other people’s examples and modify them to fit your needs:

You can get started with your first script within the “Bulk Operations” section of AdWords:

Where to view, create and edit scripts in Google AdWords
Where to view, create and edit scripts in Google AdWords

If you start a new script and then press “Show examples” at the top, you will see how to access all the different areas of AdWords with example functions. You need to copy and paste functions below the current code and remember to add the function in the “function main()” part of the script:

Example script from AdWords showing account details
Example script from AdWords showing account details

The big “Preview” button at the top should always be used on the script to see what effects it will have without making any changes unless you are certain you want them. The “Run script now” button is luckily placed far below the coding area and Google will warm you that changes will be made if you accidentally press it ahead of time.

The “Logger.log” tool seen in lines 7 and 11 can write messages to the “Logs” section of the script tool. This can show you what is happening within the script and helps debug the script if it’s not going to plan.

Once the script is saved you can either run it straight away or again schedule it for every hour, day, week, month or specific time and date:

Two script scheduled to run at different times in the month, every month
Example showing two related scripts scheduled to run at different times in the month, every month

Some of the best tricks that can be done with scripts is to have them automatically highlight issues within the account, tie them up to external systems such as weather reports, stock markets, spreadsheets, etc. or get them to automatically optimise an account based off cost-per-lead or return-on-investment values.

You can control Google Shopping campaigns or standard eCommerce ads with scripts, although conversion value data has to be driven out by using ‘Google’s AdWords Query Language’ which adds to the complexity:

It’s good practice to comment on your scripts so you can tell what each line does. To comment you just need two forward slashes together and the characters afterwards will be ignored on the same line:

Google Shopping script example with full set of comments
Google Shopping script example with full set of comments

If you never run a script then it cannot do any damage to your account. Feel free to experiment with scripts by reading the proposed changes and logs after pressing the preview button and work your way up from a simple example script to one which will really boost your AdWords account at a touch of a button.


How to get more control than AdWords scripts

adwords-apiFor large enterprise companies there may be some limitations to AdWords scripts such as the maximum 30 minute processing time by Google, a minimum period of one hour for the scripts to run and some very detailed areas of AdWords not being accessible.

To control an AdWords account at finite levels you will need to use the AdWords API. The AdWords API gives full control on the account and can be run at any time. However, it requires extensive programming knowledge to set up, and special access from Google themselves to even use the interface.


3 important things to consider with automation based on historic data

Ever heard the phrase “Garbage in, garbage out“? That’s the most important thing to consider when setting up any automatic system. A computer will not use any common sense when changing your account. It will simply do as it’s told, even if it’s doing more harm than good.

bell-curveBelow are the key considerations whilst setting up automated bidding based on historic performance:

  • Statistical significance – You need to always ensure that there is enough historic data for past results to be statistically significant. Average statistics will be a lot less ‘noisy’ when you have greater numbers of participants, allowing you to make better decisions. For example – if you looked at the past 50 visitors to a website then one day it may make one sale, and another day it may make three sales. Changing the Maximum Cost-per-clicks based off the previous day will give wildly different results each day in this example and it would be better to look at the previous month or further back for better averages.
  • Changes at different times – People interact with websites differently at different times of the day, different days of the week and through different months of the year. You need to look back far enough to overlook peak times or seasonal changes which may skew the statistics higher or lower than normal. For example – a website selling Halloween costumes will have a big rise in conversion rates on the weeks leading up to Halloween, yet a standard conversion rate afterwards. Setting maximum cost-per-clicks after Halloween based off the period before Halloween will place them too high and profits could be lost.
  • Beware of incremental changes – Running a bidding change too many times can cause extremely high or extremely low bids without any set limits and go out of control. For example – an automated rule may increase keyword bids by 5% if they achieve a target cost-per-lead under £10 based off the past 30 days. Looking back on 30 days of data raises the bids every day for two weeks resulting in a 98% increase in total, nearly double the original bid and likely higher than optimal.


adwords-rules-scriptsAutomated rules & scripts allow you to save time, fix issues, spot  missed opportunities and if needed, handle large AdWords accounts.

Automated rules are easy to set up but are limited in what they can achieve, whereas scripts require coding but allow you to perform many tasks and customised reports. Don’t be afraid to use them and remember that you can always preview the changes or review logs before implementing the changes for real.

Whenever using automated bids based on historic data, ensure that rules and filters are put in place so that the changes are meaningful and don’t get out of control.

Get content like this in your inbox, weekly.