Mon - Sun 0800 - 2000 +353 (0)867816355info@ad-tract.com

How to…use Google Ad scripts to automate actions

  • Written by Dr McFerret

Google Ads scripts can be used to automate actions in your Google Ads account, which is really useful if you know what changes need to be made in advance and would like to save some time.

For example, ad groups can be paused, keywords added, bids changed by using JavaScript code within your account. That’s not the full list of automated functions that can be created either. 

With a manager account, it is possible to amend more than one account with scripts you make too (accounts must be owned by your manager account, not sub-managed or client accounts). 

Here’s a short guide to help you with creating your own scripts and freeing up some precious time in your work day.

Pre-made scripts

This is, of course, the simplest way to implement scripts into your Google Ads account. Google has created a list of ready made scripts to use and there are some incredibly useful ones: 

Single Account

  • Reporting scripts – run auto-reports for: account summary, ad performance, customised reports, declining ad groups, keyword performance and mobile page speed
  • Bidding scripts – bid by weather, bid testing, bid for impression share, weather based campaign management, multi bidder, TV schedule bid coordination
  • Tools scripts – account auditor, automatic placement exclusion, bulk shopping ad groups, audience transition, common negative list, flexible budgets, keyword labeler, search query optimisation
  • Alerts – account anomaly detection, link checker, negative keyword conflicts
  • Optimisation score – ad rotation recommendations, budget recommendations, keyword recommendations, search partner recommendations, unused budget recommendations 

There are some slight differences between what is available for single accounts and business accounts. The full lists are available here

You can either apply the script to your ads exactly as it is or you can make edits before applying them. There are also ‘snippets’ made by Google, that are designed to be pieced together to create larger rules.

Applying a script

When selecting pre-made scripts, each one you click on includes any relevant spreadsheets to download as well as the code required. The basic process for applying scripts to your Google Ads account is as follows: 

Step 1 – Select your script. Scroll through the list and click on which one you would like to install

Step 2 – Read the configuration details provided with the script. This will help you to amend any parts of the script that are designed to be specific to you, such as URL (see Step 7)

Step 3 – When you scroll through the script details you will come to ‘Source Code’. Highlight and copy the entire script code 

Step 4 – Making sure you are logged in to your Google Ads account, click on Tools and Settings > Bulk Actions > Scripts

Step 5 – Click on the blue circle with the ‘+’ in the top left area of the page and select ‘New Script’

Step 6 – Paste your copied script into the space provided, in between the { } brackets.

Step 7 – Read through the Configurations of the script (ref. Step 2) and make any necessary edits to the code

Step 8 – Name your script – you’ll see the default name at the top is ‘Unnamed Script’. Edit this to something memorable and relevant to the script function

Step 9 – You will need to authorise the script, as Google is not allowed to make automated changes without your permission. You’ll see a yellow bar at the top of the page, which reads: Scripts make changes on a user’s behalf. You must authorise scripts before they can make any changes. Click on ‘Authorise’ on the bar. 

Step 10 – Click on ‘Preview’ in the bottom right corner. Make sure everything looks ok before your script goes live.

Step 11 – Click on ‘Run’ in the bottom right corner. 

Scheduling a script

Now it’s time to schedule your script. Your schedule will depend on the type of functions you’re running scripts for. 

If you’re using a ready made script from the Google Library you’ll find suggestions of when to schedule it in the Setup and Scheduling notes provided. 

Step 1 – On the Scripts page (Tools and Settings > Bulk Actions > Scripts), look to the ‘Frequency’ column of the table

Step 2 – Hover over the value provided in the Frequency column (which defaults to blank)

Step 3 – Click on the Pencil icon to edit

Step 4 – Choose any time you’d like to schedule your script to run – date, day of the week, day of the month and/or time

Step 5 – Click ‘Save’

You can go back to this page and edit schedules at any time.

While the Google suggestions on the configurations page are suggestions, you can choose your own schedule if you wish. 

Writing your own script

If you, or a colleague, know a thing or two about coding, you can also write your own scripts to run in Google Ads. 

There is help available on Google Developer’s site, but you probably shouldn’t go in without knowing JavaScript pretty well beforehand. Stick to pre-made scripts if you’re unsure. 

There are so many variants you can include in manual scripts from internal Google Ads data to external influences and sources. For this reason, the types of scripts you can write are immeasurable.

Once you have created your script, the steps in install are similar to the above: 

Step 1 – Making sure you are logged in to your Google Ads account, click on Tools and Settings > Bulk Actions > Scripts

Step 2 – Click on the blue circle with the ‘+’ in the top left area of the page and select ‘New Script’

Step 3 – Paste your copied script into the space provided, in between the { } brackets. Alternatively, you can write your script within the box provided and make use of auto-complete, syntax cues and indentation

Step 4 – Name your script – you’ll see the default name at the top is ‘Unnamed Script’. Edit this to something memorable and relevant to the script function

Step 5 – You will need to authorise the script, as Google is not allowed to make automated changes without your permission. You’ll see a yellow bar at the top of the page, which reads: Scripts make changes on a user’s behalf. You must authorise scripts before they can make any changes. Click on ‘Authorise’ on the bar. 

Step 6 – Click on ‘Preview’ in the bottom right corner. Make sure everything looks ok before your script goes live.

Step 7 – Click on ‘Run’ in the bottom right corner when you’re ready. (You can also click on ‘Save’ if you want to save progress and come back to it later)

Step 8 – Schedule the script (as above) for whenever you want it to run 

Other useful tips and actions

  • You’ll find all of your created scripts when you go to Tools and Settings > Bulk Actions > Scripts.
  • Beside each script, its status will be indicated. Any live scripts will have a green icon beside them.
  • To stop a script from running, you can click on ‘Option’ and ‘Disable’.
  • To start a script running again, click on the three dots > Show Disabled > Enable 
  • You can also find the history of the script by clicking on ‘Script History’ and ‘Log Statements’. For a more detailed view, click on ‘Changes’. 
  • To stop a script from running, you can click on the Stop button beside the live script.