Do you spend half of your day monitoring, updating, and tweaking your Google Ads?
If you do, that’s not sustainable—or the best use of your brain.
And the automated rules you set up don't cut it because they can't handle the frequency or level of detail you need to manage.
What you need is Google Ads Scripts.
Oh yeah, this is the big leagues. And you can absolutely be a part of this big league.
Starting from the top, we'll explain
- what Google Ads scripts are
- how they work
- how to set them up
By the end of this post, you’ll feel like a Google Ad Script pro...with a lot more free time on your hands.
TL;DR
Get brand new Google ad strategies straight to your inbox every week. 23,739 people already are!
What are Google Ads scripts?
Google Ads scripts are snippets of JavaScript code that give you better control of your campaigns. They automate internal functions within your Google Ads account and also interact with external data.
This is a Google Ads script for tracking winning and losing ads:

Why use Google Ads scripts?
Direct benefit: Google Ads scripts save time.
Automate the more tedious processes in PPC account maintenance, then focus more on optimizing actual performance.
Scripts often catch minor issues or opportunities missed by us humble humans.
There’s a lot of data to comb through in any PPC campaign, so it’s understandable if you miss a low-performing keyword or don’t recognize where you should build a new ad group.
That's why you use an automation tool. As a whole, they're meant to help optimize your Google Ads optimization routine itself.
How to set up Google Ads scripts
Scripts are intimidating if you don’t have a coding background. There are 7 parts:
- Functions
- Variables
- Objects
- Entities
- Selectors
- Methods
- Iterators
The good news is, according to Google, you only need entry-level familiarity with JavaScript—the IDE helps with syntax highlighting, auto-complete, and previewing.
Plenty of pre-built scripts are available to the public if you want to use the plug-and-chug method. But, in our experience, a little customization goes a long way, even with these pre-built scripts.
Let's take a look at script elements.
Setting scripts up in Google
- Sign in to your Google Ads account.
- Click Tools > Bulk actions > Scripts

Press the + icon to add a script.

Copy and paste your script code into the editor inside the main function:

When prompted, click AUTHORIZE so the script can access the account on your behalf. This has to be done once for each script.

Click PREVIEW to run the script in preview mode: Results will appear in the CHANGES / LOGS panel.
1. Functions
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}
2. Variables
Variables are 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.
3. Objects
In Google Ads there are only four types of Google Objects:
- AdsApp
- SpreadsheetApp
- AdsmanagerApp
- UrlFetchApp
To start, you'll probably only use AdsApp for the Object of your scripts. This tells the script to look in Google Ads for the data you want.
4. Entities
Within the AdsApp Object, there are quite a few different Entities.
There's the basic account structure to choose from (account, campaign, ad groups, keywords). Then there are 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 = AdsApp.keywords( )
5. Selectors
This is where your scripts become super helpful.
Selectors are filters for the data that your script will pull from your Google Ads account. For example, if your Variable is keywords, your Selectors will 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 makes these so awesome. By now, your script should look something like this (with some added Selectors):
function main( ) {
var keywords = AdsApp.keywords( )
.withCondition(“clicks > 50”)
.orderBy(“Conversions DESC”)
.withLimit(25)
6. Methods
Depending on the action you want to automate, methods are the commands in your code. You can have your code
- Get
- Set
- Add,” etc.
The complete list of methods is here.
7. Iterators
Iterators 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:

That’s the lowdown on ad scripts.
Next, you can customize pre-built scripts or your own custom scripts.
Different types of Google Ads scripts
There are a lot of different scripts out there, people.
Use them to report, adjust, and automate different aspects of your Google Ads account. Here are different Google Ads script 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
If your account setup is elaborate and you manage many campaigns, you’ll lean on different scripts, which is why it's lovely that there are so many different types. Just lovely 🤓
Some are more popular than others and are used by savvy digital marketers far and wide. Here are the top scripts we recommend:
14 Best Google Ads scripts examples:
Before we blaze through our favorite ad scripts—some we wrote ourselves— keep this in mind:
Scripts are a tool to guide your optimization decisions (not replace decision-making). The best scripts don’t replace the insight that comes from the brain of an experienced PPC advertiser.
This is because automation works best when customized to the specific goals of the account/campaign.
At KlientBoost, we use scripts to automate our elaborate account setups. SKAGs, SPAGs, and the like get intensive when it comes to PPC reporting and analytics. Google Ads scripts update us on everything we need.
Let's start off with the ones we built ourselves. Not to brag, but we think these are pretty awesome and helpful:
1. Heat maps
The heat maps tool is a cool script.
Some scripts automate bid adjustments; some inform your analysis before the bidding starts.
These heat maps are visual representations of users' 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—Source
2. Quality score tracker
Google Ads' Quality Score (QS) is a bit of a mystery, and it feels like a “black box” beyond your control. But keep an eye on it.
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 — 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.
3.“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.

4. 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
- N-Gram script
We rely on the N-Gram script to grow and optimize our SKAGs (Single Keyword Ad Groups). SKAGs are 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 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.
To 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.

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—Source
This script is a real-time saver when you're dealing with a large number of keywords or search terms.
6.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—Source
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.

If you don't have 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 so the script has a place to put your broken links (if you have any). But after it's set up, this one saves so much time. You can view the complete script in the link here.
8. Bid adjustment script
Our Bid Adjustment Script is a big winner. It pushes your performance that last micrometer over the finish line.
Technically, this ad script is two scripts: one for increasing and one for decreasing bids.
Increasing bids with the bid adjustment script
To increase bids with a script, set up a filter within your Google Ads account so the script knows when to fire.
You'll want to set up your search lost IS (rank) filter for greater than 30%. (It doesn't make sense to adjust bidding if your impression share lost to rank is already lower than 30%.)
Then, set your CPA max (what you're willing to pay).
The setup should look something like the screenshot below:

Locating your filters and setting them up

If keywords average below $XX CPA, increase the bid to increase traffic/conversion volume
Then, 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.
Watch this video for a step-by-step walkthrough.
Decreasing bids with the bid adjustment script
The lowering bids script works in much the same way, but there are now two different requirements for the filter:

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 to help save you time when making bulk keyword bid adjustments. 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.
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 quickly glimpse 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.

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.
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 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 analyses for you, creating more time for you to focus on implementing effective optimization solutions
This script will go through your campaigns and apply a “Winner/Loser” tag to ad variants depending on their performance.

Even better? There's no editing needed for this script 🙂—Source
This is a huge win.
You don’t have 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.
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 test in a controlled and targeted manner, the better. If you have too many ads to keep track of, though, 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 add 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.

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 complicated.
But, set up correctly, this script generates some automatic bid adjustments that should yield strong results. This wild script is more for fun, but companies do use it.
To begin, you'll need to build a Google Spreadsheet with your campaign data and the locations for each campaign. 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.
All this data needs to be housed in your original Google Sheet. It should look something like the image below:

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 set up 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:

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.

This script will populate a Google sheet so you can track the historical CTR of specific ads. This is a great way to track any changes in the ad’s user behavior, and may open up new insights into what new search terms you may need to target.
We’re the original masterminds behind SKAGs. 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 is a 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.
If you're getting an alter from this script, your ad group is in serious trouble.
Start optimizing your reporting for optimized performance
Ta da, folks!
That is a comprehensive walkthrough of Google Ads scripts.
We gave you the most popular pre-built scripts that digital marketers love, thrown in a few of our favorites, and shared our own custom scripts.
You are in a great position to plug these in and watch things move up and to the right.
We’ll say this one more time, though: scripts are tools. Like any tool, they're only as powerful as the marketer using them.
All the best 😉