Google Ads

How to Use Google Ads Scripts: A Beginner’s Guide

0 · by Dennis Moons · Updated on 2 June 2023

If you’ve been using Google Ads for a while, you know that spending hours and hours tweaking and adjusting Google Ads can be overwhelming. Nobody has that much time, am I right? 

Luckily, there are tools that can help you automate your ads’ performance and PPC reports and optimize all your shopping campaigns, known as Google Ads scripts

What Are Google Ads Scripts?

Google Ads Scripts are code snippets created in JavaScript that you can use to optimize and customize your Google Ads campaigns. With them, you can quickly automate various processes and easily manage your external data. 

For example, if you’re managing big ad campaigns and already know how to use JavaScript-based tools, Google Ads scripts can be quite beneficial for your ecommerce business. 

With Google Ads scripts, you’ll be able to save a lot of time and, instead of managing your ads manually, spend your free time improving other aspects of your business.

Doesn’t this sound nice?

If you nodded, and I’ll assume you did, I’ll show you how Google Ads scripts can make your life a bit easier. 

Let’s start by explaining the basics of Google Ads scripts and continue with an overview of how to create, test, and monitor them, as well as ensure their safety.  

How do Google Ads Scripts Work? 

Google Ads scripts are not hard to master if you know how to use JavaScript. 

By implementing code snippets, merchants can adjust and modify their bids and ad groups or add product keywords

When you create a Google Ads script, you and everyone who has access to your account will be able to edit, remove, or review articles from your Google account. 

So, how are Google Ads scripts used?

There are several ways merchants use Google Ads scripts, and these are some of the most common ones: 

  • Add code like conversion data from external platforms and sources to create bidding changes and inventory data for pausing or unpausing specific keywords. 
  • Create and modify reports and add them to spreadsheets. 
  • Increase CPS bidding for product keywords that managed to collect around 1000 impressions in the past seven days. 
  • Create reports for multiple accounts, monitor specific issues, such as broken links or inaccurate keywords, and troubleshoot them. 

When you’re working with scripts, there’s one important thing you’ll need to remember: any of the changes you make on a script in Google Ads will be permanent, and you won’t be able to return the script to its previous state. 

So, be careful when editing a script, and you’ll have nothing to worry about.

Google Ads Scripts that are longer than half an hour or an hour, such as scripts created from a manager account, always time out. Keep in mind that when they do, all the changes you’ve created might not be saved. 

If you want to make sure that the Google Ads script ran and there was no timeout, just go to Logs and see its progress. When the script times out, Google Ads advises merchants to refine it. After that, you can rerun the script.  

Can Merchants Schedule Scripts? 

Another great thing about Google Ads is that it lets you schedule your script. The process is pretty simple, and by scheduling it, your scripts can run in specific timelines, such as once per day, week, month, or even at a specific hour throughout the day.

To schedule a script, go to “Scripts” located under “Frequency.” Then, adjust the value for frequency. You’ll notice that there’s nothing written there. Click on the small pencil graphic and select the specific timeframe when you want to schedule your script. 

Once you set the time frame, click on the “Save” button. The scheduling scripts settings can be altered, so whenever you want to rerun a specific script, but this time in a different time frame, you can go through the exact same process from scratch. 

Getting Started with Google Ads Scripts 

Creating a script in Google Ads might sound a bit difficult, especially for merchants who are not proficient in JavaScript. If you’re one of them, you can set up automatic rules and focus on improving your JavaScript skills before you start creating scripts. However, if you’re a coding pro, the process will be a piece of cake. 

What’s Included in the Scripts Dashboard? 

Once you log in to your Google Ads account and go to Scripts, you’ll notice that there’s one page with a list of scripts and one page called Script History, where you can find all the past scripts that were uploaded or created through your Google Ads account. 

Script history in Google ads

On the scripts dashboard, you can find how your scripts are performing, their uploads, edits, and rules. You can choose to see data from the last seven days or the last thirty days in the top right corner. 

A screenshot preview of the scripts dashboard in Google Ads

How to Create Your Own Scripts in Google Ads 

First of all, log in to Google Ads, and click on the icon “Tools.” 

drop-down menu on the left side where you can find Tools in Google Ads

Then, click open the drop-down menu, click “Bulk actions”, and then click “Scripts.”   

drop-down menu where you can find Bulk actions and Scripts in Google Ads

To create a brand-new script, click on the + button. 

A screenshot of the + button where you can add a new script

Then, a square will pop up, and you’ll notice the field called “New script” right under the + button. 

A screenshot of New script under the + button

After you click on New Script, you’ll be redirected to a new page where you can add a script name, and in the editor box, you can add your code snippets. 

When you choose to create your scripts directly in the edit section, Google Ads lets you use and modify them by adding indentation and syntax cues. 

A screenshot of Google Ads where you can write down your script’s name and add code snippets

Once you finish writing your script, click the “Save” button under the editor box. If you’d rather see how the script looks before uploading it, click “Preview.” 

Google Ads will send you a message to confirm the script authorization and create the changes in your Ads account before you are able to preview or implement the changes.

If you want to let Google Ads make the changes, click “Authorize.” After that, you can click the button “Grant access” to let the platform create the necessary changes. 

Once you’re 100% sure you want the script to run, click on the “Run” button below the editor box. Every time you let a script run, you can find it under the section “Logs” and check out its progress. When you want to stop using a specific script, you can simply click “Stop” next to all the active scripts in your account. 

Skills You Need to Use Google Ads Scripts 

Now that I’ve introduced you to the basic features of Google Ads Scripts and how to use the tools, let’s take a look at the one skill you’ll need in order to elevate your scripts to the next level. 

JavaScript Syntax 

As I’ve already mentioned, you must have JavaScript knowledge to use Google Ads Scripts. Otherwise, you won’t be able to find your way around the rules or create accurate code snippets.

Luckily, you don’t need to be a JavaScript pro to create scripts for Google Ads. You only need to have entry-level knowledge to create the scripts since the integrated development environment (IDE) will help you change your syntax by highlighting inaccuracies and even finish the codes automatically, if necessary. 

Also, you can find a large selection of pre-created Google Ads Scripts online that you can use anytime you want to. However, keep in mind that your ecommerce business will benefit more if you create a few changes in them here and there. 

Customizing your scripts for your business’ purpose is always a smart move since you can edit and modify parts of it the way it suits your needs the most. 

3 Best Tips for Using Google Ads Scripts 

To use this tool even more effectively, I’ll give you some of the best practices for using Google Ads Scripts. 

  1. Testing and Debugging Scripts

If you want to test or debug your scripts in Google Ads, use the preview mode. While you’re in preview mode, you won’t be able to make any modifications to the script or the ad campaign. This mode only shows the specific modifications Google Ads will make if you set up and save the script. 

While you’re in preview mode, you’ll be able to test, customize, and fully develop your coding snippets without any risk of creating some unwanted or unnecessary edits in your Google Ads information. What’s more, the preview mode only affects the AdsApp. The rest of the Google Ads services, like Google Spreadsheets or Google MailApp, will proceed to run without any additional changes, regardless of whether you’re testing the script in preview mode or you’ve already saved it and set it up. 

After testing and previewing how the final version of the script looks, you can save it and set it up to run instantly or schedule it for later. Also, keep in mind that through its execution data, your code snippet has the ability to determine whether it’s running in preview mode or not. If you’re interested, you can read additional information on execution info by Google Developers. 

Here’s an example of a code snippet that won’t work properly during the preview mode: 

A screenshot from Google Developers on the inaccurate code snippet
  1. Monitoring Script Performance 

Google Ads scripts attempt to make changes to Google Ads data, but if a certain change is unsuccessful, the script records it into the Changes log and proceeds with the execution:

Screenshot from Google Developers from a script with an error

Here are other operations that can cause errors in your scripts: 

  • Adding keywords that cost more than what you have in your Google Ads campaign optimization budget 
  • Adding an already-existing name for an ad campaign 
  • Setting up a new ad group in an ad campaign even after you have passed your limit for creating ad groups

Some code snippets have a wrong date range that causes the script to stop executing properly, and you’ll notice a recorded error message in your text logs. Watch out for errors like this one and never ignore them: 

A screenshot from Google Developers of an error in a Google Ads script that you should never ignore
  1. Ensuring Script Security  

In order to ensure script security, the first thing you can do is limit access to the scripts. The good thing about Google Ads scripts is that you need to manually grant each script permission to run. You can also preview which users logged in and manually edited or added scripts to assess whether there are some abnormal activities. 

If you want to review past permissions that you granted for Google Ads scripts, go to the security page on your Google Ads account and go to Manage third-party access. You can also manually add the 2-step verification from your account to keep your account secure and get a notification any time someone else enters it. 

So, How Beneficial Are Google Ads Scripts?

The short answer is – a lot! 

As you can see for yourself, Google Ads Scripts is one of the most valuable assets of Google Ads. Without a doubt, the biggest benefit of using automated scripts is that they’ll help you avoid time-consuming tasks.

All you really need to use the benefits of Google Ads scripts is to have knowledge of JavaScript, and you’re ready to start exploring them. By using them, you can optimize and automate various processes that would take a lot longer without using scripts, such as PPC management techniques, bid management strategies, and bulk changes of your Google Ads campaigns.
If you’re interested in learning more about another awesome tool by Google, check out our article on Google Auction Insights.

Dennis Moons

Dennis Moons is the founder and lead instructor at Store Growers.

He's a Google Ads expert with over 12 years of experience in running Google Ads campaigns.

During this time he has managed more than $5 million in ad spend and worked with clients ranging from small businesses to global brands. His goal is to provide advice that allows you to compete effectively in Google Ads.

Follow him on Twitter or LinkedIn.

author-picture