An Introduction to Google Ads Scripts

I genuinely believe that Google Ads scripts are the most powerful tool in a PPC Manager’s arsenal.

With a few short lines of Javascript text you can automate almost any task within Google Ads.

Moreover you can connect Google Ads to external data sources, allowing you to do all sorts of cool stuff, like bidding based on the number of rooms that are available within your hotel to turning your ads on when it’s snowing outside.

And lot’s of mind numbingly boring stuff too, like creating reports and removing poor performance ads & keywords that don’t require any higher cognition.

The best thing is that you don’t even need to code. There are hundreds of pre-built scripts that you can simply copy and paste into your account.

In this article we’re going to first look at why Google Ads scripts are so great, how you can set them up as well as where you can find hundreds of pre-made ones that you can copy and paste into you account and start straight away.

Here’s why Google Ads scripts are great..

  • Automate tedious tasks that don’t require any higher cognition. Lots of tasks that a PPC manager do on a day to day basis are mundane and tedious. At Clicteq we’ve managed to automate around 80% of these allowing account managers to focus on more fun stuff like strategy, and we would suggest that you do the same.
  • Get more done with less human error. I’ve yet to meet an account manager who works on an Adwords accounts 24 hours per day and has never made a mistake. Adwords Scripts can run each hour of the day 24 times per day making millions of changes with no errors. Pretty good right?
  • Spend more time strategising and less time manually reporting. Most PPC account managers spend so much time implementing and putting out fires that they hardly spend any time strategising on their accounts. By automating all of the reporting and 80% of management tasks it allows them to spend time analysing reports in detail and putting together a strategy to continually improve performance.
  • Make adverts dynamically at scale. When you’ve got 100,000 products and you need to write ads for each one, you’re in for a long afternoon. Not with scripts! This is a great example of a task that you could quickly automate in a few mins using a template that is then populated with product data, like the name, price and stock level.
  • Scripts overcome limitations within the Google Ads Platform. One of the key advantages of using Google Ads scripts is that they can overcome the limitations of the Google Ads platform. For example using manual scheduling you can’t change bids more than 6 times per day. Which when conversion rates fluctuate hour to hour isn’t so great. However with the use of a Google Ads script you can set up a schedule to run 24 times per day making you more agile than 99% of your competitors who’re being limited by Google’s platform.
  • Scripts allow you to link external data. As I’ve touched on slightly before, scripts allow you to link to external data sources. You can use this for reporting, for example by connecting to Google sheets to output a report. You can use this for notifications so that Google sends you an email or a text message when certain things happen. The other main use is bidding. Either based on your own in-house data such as availability of rooms in a hotel, or products in stock. You could also use it to bid based on forex rates, crime rates and weather data as we have done for our clients.

How to set up Google Ads scripts

So you’re confronted with a scary looking block of code, that looks like you’d need a PHD in computer science to understand it.

But fear not Google Ads scripts are fairly easy to set up even if you’ve never written a line of code in your life!

Step 1. Navigate to the Google Ads Script Dashboard

So first head to the Google Ads Script dashboard by clicking on the tools icon and then from the main menu under the bulk actions header select Scripts.

Step 2. Click the blue + icon in the top left hand corner of the screen

Click the blue + icon in the top left hand corner of the screen to add a new script.

Step 3. Paste the script into the account

Copy and paste the script that you want to use into the account and you should end up with something that looks like this and for most scripts your ready to go. Not too difficult right?

Step 4. Configure the script to your requirements.

Most scripts will have some form of configuration within them that you can change.

Carefully read the documentation and make the changes within the controls section of the script to customise the functionality. This is usually located at the top of the script.

A couple of the most common configurable steps are adding a URL for a Google Sheet to create a report.

The second would probably be adding campaigns or ad groups to be included or excluded.

Step 5. Authorize the script, preview it and run it!

There will be a yellow bar across the top of the screen in most cases asking you to authorize the script to run. Simply click the authorize button to give the script permission to be run.

Once you’ve done this hit the preview button and you will then see a log statement that will show you what changes the script would make if it was run.

If it all looks okay at this point then hit the run button and you’re script will run for the first time.

Step 6. Set the frequency that you want the script to run on.

Most scripts you will want to run on a schedule so that they automatically run either on an hourly, daily or monthly basis.

Some scripts like the 24 hour bidding script for example will need to run on an hourly basis for them to work as desired.

Quality Score trackers such as this one will usually have to be scheduled to run on a daily basis so that it will plot quality score fluctuations to a graph for each day for example.

It’s important that you read the documentation here to see if there are any specific scheduling requirements for the script to run as intended.

If not then you can simply run the script on an ad hoc basis when you need the functionality.

The anatomy of a basic Google Ads Script

Source: Search Engine Land

There are several different elements that make up a basic Adwords Script:

  • Function: A function is a block of code that is contained between two curly brackets that can be run by being called. You call the function by writing out its name.
  • Variable: This stores information that can then be accessed later on.
  • Objects: An Object is a collection of Entities. In this case the Object is Adwords.app
  • Entities: The AdWordsApp Object is made up several entities such as campaigns, ad groups and keywords. Here on the second line the entities are keywords.
  • Selectors: Selectors allow you to narrow down the choice of entities that you have selected. Here the selector finds only keywords that are enabled, it then sorts them in descending order by impression based on yesterday’s data. It then limits the list to 10 keywords.
  • Methods: Methods are tasks for example Get”, “Set” and “Add”. In this case the method is get.
  • Iterator: Iterators tell the script to keep going in a loop. For example here while there is still another keyword in the list the script will keep running.
  • Logger Output: Logger output allows you to write to the preview panel which is great for debugging. However it will slow your script down so consider removing this once you’re happy that the functionality looks correct.

Resources

Pre-built Scripts

There are a lot of great resource for finding pre-built Adwords Scripts that you can just copy and paste into your Google Ads and start automating boring tasks today:

Building your own scripts

If you’re looking to build your own scripts then we would suggest checking out:

  • Codeacademy – they have a great introduction to Javascript code course.
  • Google For Developers – Google documentation is a great place to find code snippets and examples of how you should develop your Adwords scripts as well as being a comprehensive reference document. It is also worth looking out on their site as they often run introduction to Adwords Scripts courses that you can attend in London.
  • SMX east presentation – on Google Ads Scripts by Steve Hammer and Russell Savage.
  • Adwords Scripts for every level part 1 – The first in a three part series by Search Engine Land that teaches you how to read Google Ads scripts.
  • Adwords Scripts for every level part 2 – The second edition with intermediate tips on troubleshooting script errors
  • Adwords Scripts for every level part 3 – The third edition on building your own Google Ads scripts with Advanced tips on unleashing the power of scripts.
  • Adwords Scripts for every level part 4 – The fourth and final edition of the series with a free case study on how to use scripts
wesley parker
About wesley parker

Wesley is Founder and CEO at Clicteq. He currently manages a £6 Mil Adwords portfolio across a range of different sectors. He regulally features in leading search publications such as Econsultancy, Campaign Magazine and Search Engine Land. You can follow him on Twitter or connect with him on Linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *