Get PPC & CRO Knowledge Right To Your Inbox
Covering topics to help your business make more money.

Google Ads Scripts: The Complete Guide
(+ Our 14 Favorite Google Ads Scripts)

by Sean Martin under PPC

Get Your Free Proposal

251 Businesses Got a Proposal From us Last Month (Dec, 2018). You should Get One Too.

Competitor Info
Optimization Tips
Custom Pricing
Last Step
Previous step

Don't worry! We need your website and contact info because we want to send you our research for your free proposal.

Send my free proposal
Previous step



Please look out for an email from us.

problem here.

try again

This post has been updated with fresh content and new links for our favorite readers.
(Especially you.) 😉
Original Publication Date: July 2, 2018

Implementing Google Ads scripts into your campaigns doesn’t have to be a daunting process.

Google Ads scripts are meant to help ease/automate your PPC reporting and performance, after all. So, a helpful guide on the value of these complex code snippets and how to use them goes a long way.

These scripts are tools to automate and optimize your PPC campaigns. From bid management and split testing, to improved reporting and avoiding repetition, they’re as useful as you make them. And, what makes these tools so great, is that they’re incredibly customizable.

Want to see how we’re using Google Ads scripts for specific clients? Get a free proposal from us and we’ll show you.

This post will cover what exactly Google Ads scripts are, how they work, and how to set them up. Not only that, we’ll also cover a few popular scripts that digital marketers use, and our 14 favorite here at KlientBoost.

"[Google Ads Scripts] are coming"

“[Google Ads Scripts] are coming” – image source

That’s a lot of ground to cover. Let’s get started.

What Are Google Ads Scripts?

In the most basic definition, Google Ads scripts are snippets of JavaScript code that allow you to better control your campaigns. They can be used to automate internal functions within your Google Ads account. And they can interact with external data as well.

Below you can see an example screenshot of a Google Ads script:

A custom script for tracking account level Quality Score

A custom script for tracking account level Quality Score – image source

Why Use Google Ads Scripts?

Now, the most direct benefit of using Google Ads scripts is that they save time. By automating the more tedious processes in PPC account maintenance, you can focus more on optimizing actual performance.

Not only do they save time, but scripts can often catch smaller issues or opportunities that you may have missed.

We’re only human, after all. There can be a lot of data to comb through in any given PPC campaign. So missing a low performing keyword or a chance to build a new ad group is understandable.

That’s where these helpful automation tools can be a big help. As a whole, they’re meant to help optimize your Google Ads optimization routine itself.

Get Your Proposal

How to Setup Google Ads Scripts

If you don’t come from a coding background, scripts can be pretty intimidating. I should know — ‘cuz I don’t come from a coding background and I was super intimidated when I began researching for this blog post.

You gotta be tough, like Blake.

You gotta be tough, like Blake. – image source

There are plenty of pre-built scripts available to the public if you want to go with the plug-and-chug method. But, in our experience, a little customization goes a long way, even with these pre-built scripts.

So, to make sure you can hold your own when setting up your Google Ads scripts, let’s take a look at their different elements.


The Function is the first part of the script code and is fittingly what gets things started. You’ll always need one when using Google Ads scripts. The Function element of your script should look something like this:

function main( ) {code to execute}


The next part of the script you’ll see are the Variables. They’ll typically be expressed as “var” something. Variables are containers that store data values — this is where the customization comes in handy. You can use whichever data in Google Ads you want to access. Just keep in mind each Variable must correspond to specific Objects and Entities in your Google Ads account.


In Google Ads there are actually only four types of Google Objects: AdWordsApp, SpreadsheetApp, MccApp, and UrlFetchApp.

For starters, you’ll probably only be using AdWordsApp for the Object of your scripts. This tells the script to look in Google Ads for the data you want.


Within the AdWordsApp Object, there are quite a few different Entities.

There’s the basic account structure to choose from (account, campaign, ad groups, keywords) as well as Ad params, Labels, Ad Schedules, Budgets, and even some targeting.

When you combine your Variables, Objects, and Entities together to get the code snippet below:

var keywords = AdWordsApp.keywords( )


This is where your scripts can become super helpful. Selectors are filters for the data that your script is going to pull from your Google Ads account. For example, if your Variable is keywords, your Selectors will help filter which keywords the script references.

Most Selectors fall under one of the below types:

  • withCondition( )
  • withIds( )
  • forDateRange( )
  • orderBy( )
  • withLimit( )

You can use multiple Selectors to continually refine the data you’re looking at, which is what makes these so awesome. By now, your script should look something like this (with some added Selectors):

function main( ) {
var keywords = AdwordsApp.keywords( )
.withCondition(“clicks > 50”)
.orderBy(“Conversions DESC”)


These script elements are the commands in your code. You can have your code “Get,” “Set,” “Add,” etc. depending on what type of action you’re trying to automate.

The complete list of Methods can be found here.


Iterators essentially keep your script continually firing. By using the hasNext() and next() Iterator, you set up a loop that will continue to fire as long as your script keeps returning valid data.

When you put all the moving parts together, you get something that looks like the image below:

The annotations help translate the script.

The annotations help translate the script. – image source

Now that you know the different parts that make up your Google Ads scripts, you can better customize whichever scripts you choose to use — your own custom scripts or pre-built ones.

You can insert your script into your Google Ads account under the “Bulk operations” tab on the left.

The scripts window allows you to manage existing scripts and create new ones.

The scripts window allows you to manage existing scripts and create new ones.

So, having run through the basics of what make up all Google Ads scripts, let’s take a look at the different types of scripts and their features/benefits.

Different Types of Google Ads Scripts

There’s a lot of different scripts out there, people. And they come in all different shapes and sizes — reporting and adjusting and automating all different aspects of your Google Ads account. For the most part, they fall under one of the below types:

  • Bid Modifiers
  • Pausing and Deleting
  • Third-Party Data
  • Bidding and Budgets
  • Tools
  • Alerts
  • Reporting
  • Seasonal Adjustments
  • Automating Maintenance
  • Labeling
  • Tracking
  • Ad Text
  • Keywords
  • Google Display Network
  • Shopping Campaigns

Depending on how elaborate your account setup is, and how many campaigns you’re managing, you may lean on different scripts more than others. Which is why it’s so nice that there’s so many different types.

There are, of course, some that are more popular than others, and are thus used by a bulk of digital marketers.

1) 24/7 Bidding

Google Ads only has 6 default bidding time periods to choose from. But, thanks to Brainlabs, there’s a Google Ads script that allows you to customize your bids by the hour.

After all, it doesn’t make much sense to be bidding on “pizza delivery” keywords at 9:00 in the morning. But it sure does at 7:00 pm.

Brainlabs even built a template of the spreadsheet you’ll need to reference in your script:

This spreadsheet would be the Object in your script.

This spreadsheet would be the Object in your script. – image source

2) Heat Maps

Another super popular script that digital marketers use en masse is the heat maps tool.

Not all scripts are for automating actual bid adjustments, etc. Some are for actually helping your analysis before the bidding even gets started.

These heat maps are visual representations of user’s search behavior. You can see an example of a click-through rate heat map below:

This shows some significant differences in CTR during certain hours and days.

This shows some significant differences in CTR during certain hours and days. – image source

3) Quality Score Tracker

Google Ads’ Quality Score (QS) is a bit of a mystery. They treat it like a “black box,” which makes it seem like QS is beyond your control. But that doesn’t mean it isn’t worth keeping a weather eye on.

Thanks to the team over at the PPC Epiphany blog, there’s a script that even comes with a dashboard as well.

It's a great tool for correlating QS to impressions.

It’s a great tool for correlating QS to impressions. – image source

This specific script will track the QS for all your keywords, so you can even go back for some historical analysis. And, as always, you can customize the script with the specific Selectors you want to use.

4) “0” Impressions Pause

This one is a simple but helpful little script. As the name implies, it automatically pauses any ads running for keywords that are generating zero impressions.

This is a great way to eliminate the worst performers from any given ad group before they start generating any wasteful clicks and traffic. Shouts to Russell Savage for this one (and the next one, to be honest).

5) Broken URLs Report

Another super convenient script is the Broken URL Report that Russell Savage also built. It’s pretty straightforward and can help solve a problem that many of us face from time to time.

When we delete a page from our domain or change the URL of certain pages, we can sometimes forget to adjust the rest of our SEM account. This is where broken links come from, either returning 404 Not Found or 500 Server Error response codes.

This script will send you a report with any broken links so you can update them as soon as possible before they start costing you valuable traffic.

Our Favorite Google Ads Scripts (From the KB PPC Experts)

There’s plenty of great Google Ads scripts that are already available for you to copy-and-paste into your account. These are just a few of the most popular. But, keep in mind that scripts are a tool to help improve your optimization decisions (not replace your decision making).

Even the best scripts can’t replace an insightful PPC advertiser with optimization on the mind.

This is because automation truly works best when it’s customized to the specific goals of the account/campaign.

At KlientBoost, we like to create our own scripts to help automate our elaborate account setups. SKAGs, SPAGs, and the like can get intensive when it comes to PPC reporting and analytics. So we rely on our Google Ads scripts to keep us updated on everything we need.

Below you can check out our favorite Google Ads scripts. Some we’ve made ourselves and others we simply appreciate for being awesome. Let’s start off with the ones that we’ve built ourselves. Not to brag, but we think these are pretty awesome and helpful:

Kind of a big deal, you know, whatever...

Kind of a big deal, you know, whatever… – image source

6) N-Gram Script

The N-Gram script is a really neat script that we like to rely on to help grow and optimize our SKAGs. If you don’t know already, SKAGs are Single Keyword Ad Groups designed to create more relevant ads with improved Quality Score, CTR, and CPC.

SKAGs work by isolating the keywords you’re targeting to a singular search term. By aligning your search term:keyword ratio closer to a 1:1 correlation, you can control the type of searchers are viewing your ads.

But if you plan to maintain and grow these SKAGs, you’ll have to deal with a great deal of granularity. And a lot of ad groups.

I mean...a lot of ad groups.

I mean…a lot of ad groups. – image source

To help grow these ad groups and ensure they don’t overlap with one another (that would kind of defeat the point, wouldn’t it?), we rely heavily on negative keyword lists.

This is where the N-Gram script comes in so handy. You can view the entire script in this Google Doc.

This script will take all the search queries within a certain time frame and allow you to extract 1-word, 2-word, and 3-word strings within the account to help with negative keywords and new SKAG creation.

The red boxes are where you can edit the script.

The red boxes are where you can edit the script.

You’ll have to make a new Google Doc for this script, so your data can populate somewhere for you to reference. The spreadsheet will look something like the screenshot below.

You can continue to filter your new search terms within this spreadsheet.

You can continue to filter your new search terms within this spreadsheet.

This script is a real time saver when you’re dealing with a large amount of keywords or search terms.

7) Link Checker Script

Our Link Checker script is much like the broken link scripts that you can find elsewhere online.

This script goes through your account on whatever schedule you choose and looks for broken links. To be more specific, it looks for ads that are returning broken link 404s.

Again, the red box is your account-specific edits area.

Again, the red box is your account-specific edits area.

If you don’t have any broken links, you won’t get any notifications — which is nice for marketers who don’t want to read pointless email notifications. You only get an email notification if there are any broken URLs within your account.

You’ll have to create a Google Doc for link for the script to place your broken links (if you have any). But after it’s set up this one is a real time saver. You can view the complete script in the link here.

8) Bid Adjustment Script

If you’re looking to consistently be on the optimization edge, these scripts are going to be of great help. Our Bid Adjustment Script is a big winner — especially in terms of pushing your performance that last micrometer over the finish line.

You, trying to milk your Google Ads account for every last conversion.

You, trying to milk your Google Ads account for every last conversion. – image source

For starters, this script is technically two scripts: one for increasing and one for decreasing bids.

Increasing Bids With The Bid Adjustment Script

To increase bids with a script, you’ll have to set up a filter within your Google Ads account so the script knows at what point to fire.

You’ll want to setup your average position filter as worse than 2.4. (It doesn’t make sense to adjust bidding if you’re already getting placements better than 1.5.) Then, set your CPA max that you’re willing to pay.

The setup should look something like the screenshot below:

So: if keywords average below $XX CPA, you can increase the bid to increase traffic/conversion volume.

So: if keywords average below $XX CPA, you can increase the bid to increase traffic/conversion volume.

Then, you place the script into your Google Ads account to make sure this [RAISE BIDS] function works (you can see the Raise Bids Script here). This way, your account will automatically adjust the bids for keywords that fit through this custom filter.

You can watch this video for a more thorough walkthrough of the process.

Decreasing Bids With The Bid Adjustment Script

Now, the lowering bids script works in much the same way. However, in terms of the filter, there are now two different requirements that must be filled:

Cost/Conv must be over a certain threshold, AND there's a spend minimum.

Cost/Conv must be over a certain threshold, AND there’s a spend minimum.

With this script, any keyword bids that fit this filter will start lowering by 5% – 20% every time. (You can see the Lower Bids Script here.)

One last note on these two scripts before moving on. These scripts are meant for bulk keyword bid adjustments to help save you time. For specific campaigns or ads, however, it’s important you address singularities as such. And if you have specific keywords that are bleeding money, make sure you address them in a more granular fashion.

9) Ad Spend Report Script

Now, here’s a script that our PPC Account Managers really love. This script will send you recurring emails within an account update on quite a few different KPIs:

  • ad spend
  • conversions
  • CPA
  • recommended daily spend
  • current daily spend

This is a great way to get a quick glimpse of your account performance before diving into the nitty-gritty of analytics. It’s also a huge plus if you’re managing multiple clients and want to get an overview to prioritize which accounts to address first.

This script really depends on how you customize the time frame.

This script really depends on how you customize the time frame.

You can set this script to send you reports on any given timeframe. This is where the scripts customizability becomes very important. Check out the full script here.

You can set this for daily updates if you want. But it’s important you give any alterations you may be running enough time to reach statistical significance before reporting and analyzing the results.

10) Our Ad Copy A/B Test Script

We’re really proud of this custom script that we created in-house at KlientBoost.

This script will comb through any campaigns you’re running and actually analyze some of your data for you. This is a huge step forward, as most Google Ads scripts focus on reporting and aggregating data to make your analysis easier.

This script takes automation to the next level by handling some of the easier analysis for you, creating more time for you to focus on implementing effective optimization solutions.

This script will actually go through the campaigns you’re running and apply a “Winner/Loser” tag to ad variants depending on their performance.

Even better? There's no editing needed for this script.

Even better? There’s no editing needed for this script. 🙂 – image source

This is a huge win. Instead of having to click through each ad variant to see CTRs and Conversion Rates, you can see a clear “Winner” or “Loser” tag at the ad level.

You can also filter through the campaign by labels, which makes viewing your winners and losers even easier.

Finally, you can pause the losing variants and make new ads to test against your winners. Check out our full script here to get started.

11) Low CTR Ad Pausing Script

Depending on what kind of optimization routines you’re running and what kind of ad rotation you’re using, you might be dealing with quite a few ad variants.

Now when it comes to testing, the more variants you’re able to test in a controlled and targeted manner, the better. If you have too many ads to keep track of, however, some can fall through the cracks. More specifically, certain losing variants may not be turned off or deleted.

These slip-through ads may seem like a small oversight, but they can ad up in terms of wasted ad spend.

This is why the Certified Knowledge script for Pausing Ads with Low CTR is such a quick and easy solution.

A real short snippet of code, at that

A real short snippet of code, at that – image source

This script will automatically pause the lowest performing ad in your campaign, so long as there is at least one other variant. It’s a great way to continuously refine your account by cleaning out your worst performers.

12) Bid By Weather Script

Adjusting your bids by using a weather script can get fairly complicated. But if you set it up properly, this script can generate some automatic bid adjustments that should yield strong results.

To begin, you’ll need to build a Google Spreadsheet with your campaign data and the locations for each of your respective campaigns. You’ll also have to integrate a call to the OpenWeatherMap API for each location.

The script will calculate weather conditions for each location based on some basic rules. Then it will trigger your bid-multiplier to increase the bids for certain locations based on specific rules you’ve defined.

Keep in mind that all this data needs to be housed in your original Google Sheet. It should look something like the image below:

First, you'll have to setup your campaign details.

First, you’ll have to setup your campaign details. – image source

That’s not all the data you’ll need, however. You’re going to have to set some very clear parameters to make sure the weather adjustments work as you want them to.

For example, after you setup your campaign location data, you’ll need to set the actual weather adjustment rules (the changes in the weather that launch your script). You can see a screenshot of that below:

These are some considered parameters for the script.

These are some considered parameters for the script. – image source

Lastly, you’ll need to align your OpenWeatherMap API code with a Google Ads geo-targeting code to make sure your ads appear in the right weather conditions and in the right location.

With this script in place, you can automatically increase bids for weather-affected ad campaigns in your specified locations.

For instance, someone is more likely to be searching for “local ice cream shops” on a hot, summer day than a cold rainy one — so increasing your bids when a hot front roles in makes sense for more conversions.

13) Changes in CTR Script

We use our SKAGs method to create highly relevant ad copy that targets actual user search terms to increase CTR. So, it’s important that we keep that CTR as high as possible to ensure that we are still generating highly qualified clicks.

Because of this, a script continuously monitoring our ads’ CTR would be incredibly helpful.

And thanks to Sean Dolan from Pushfire, we have one. 🙂

You can view the whole script on Evernote.

You can view the whole script on Evernote. – image source

This script will actually populate a Google sheet so you can track the CTR of specific ads, historically. This is a great way to track any changes in user behavior in relation to your ad, and may open up new insights into what new search terms you may need to target.

14) Declining Ad Groups Report Script

Being the original masterminds behind SKAGs, we work with a lot of different ad groups. Just like the N-Gram script helps manage and grow our ad groups, this script helps us keep their performance up to par.

The Declining Ad Groups Report script will produce a multi-tabbed spreadsheet that will populate with any ad groups that are dropping in performance. It will look something like the image below:

This screenshot is for a multiple-account view.

This screenshot is for a multiple-account view. – image source

This is an pre-built Google Ads script, so there’s not as much customizability as some other scripts out there. So you’ll have to work within the Google Ads definition of certain parameters:

  • Ad groups that are enabled (on) and are part of an enabled campaign.
  • The ad group’s CTR (click-through-rate) has decreased.
  • The ad group’s CTR has been decreasing for 3 consecutive weeks.

That last criteria is the big kicker. This means that the script isn’t going to notify you any time any ad group sees a small dip in clicks. Which is good. This is a natural filter to ensure a higher rate of statistical significance.

Which means that if you’re getting an alter from this script, your ad group is in serious trouble.

Start Optimizing Your Reporting for Optimized Performance

So we’ve run the gamut in terms of Google Ads scripts. We’ve addressed the most popular pre-built scripts that digital marketers love to use. And we’ve even thrown in a few of our favorites and our own custom scripts.

Always remember, though: scripts are tools, and just like any tool they’re only as powerful as the marketer using them.

So get cracking. 😉

Klientboost Blog Author Sean Thomas Martin Junior III

Sean Thomas Martin Junior III

Director of Content

Over 419 businesses got a proposal from us in October, 2020

free proposal graphicfree proposal graphicGET MY FREE PROPOSAL

What's In The Proposal?

Competitor Info
Competitor Info
Optimization Tips
Optimization Tips
Custom Pricing
Custom Pricing
... and so much more!
Last Step
Previous step

When it comes to PPC, the first person I turn to is Johnathan Dane. He and his team cut through the bullshit and get straight to the point with the goal of making you more money. Work with him.

Peep Laja
Peep Laja
Founder @ ConversionXL
Please enter a valid URL (e.g.
Send my free proposal
Previous step
phone icon

Prefer to call?

Reach us directly to chat with one of our PPC & CRO experts

Call Now

(866) 204-2028



Please look out for an email from us.

Close window

problem here.

try again