🎉 84.5% of Our Clients Hit Their Q2 Goals - It All Starts With a Marketing Plan 🎉

21 Killer Google Ad Scripts You Don’t Know [2023 Update]

Johnathan Dane
Johnathan Dane
KlientBoost Logo
Get Your Free Marketing Plan,
Custom Tailored For Your Industry

It’s not realistic to spend more than half of your day monitoring, updating, and tweaking your Google Ads.

And the automated rules you set up don’t cut it. They can’t handle the frequency or level of detail that you need to manage.

You’re ready to graduate to the big leagues: Google Ad Scripts.

Google Ads scripts are tools to help you automate your PPC reporting and performance. They can automate and optimize your Google Ads campaigns for you. From bid management and ad split testing to improved reporting and avoiding repetition.

They’re incredibly customizable so they have the power to be as useful as you make them. 

Don’t get intimidated though. We’re here to make it less daunting and give you scripts more impactful than you ever imagined.

Starting from the top, we’ll explain what Google Ads scripts are, how they work, and how to set them up. With that solid foundation we’ll move onto the good stuff: popular scripts all the best ad managers use and, best of all, our 14 favorite scripts here at KlientBoost.

By the end of this post, you’ll feel like a Google Ad Script pro...with a lot more free time on your hands.

Jump to:

    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:

    Google Ads Script Example
    A custom script for tracking winning and losing ads

    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.

    If you don’t come from a coding background, scripts can be pretty intimidating. The good news is, according to Google, only entry-level familiarity with JavaScript is needed—the IDE helps with syntax highlighting, auto-complete, and previewing.

    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.

    1. Sign in to your Google Ads account.
    2. Click the Tools icon and select Scripts under BULK ACTIONS.
    Locating Google Ads Scripts
    Selecting scripts under bulk actions
    1. Press the + icon to add a script.
    Locating Adding Google Ads Scripts
    Adding a script
    1. Copy and paste your script code into the editor area, inside the main function:
    Example of a Google Ads Script
    Example of a code you may be pasting in scripts
    1. When prompted, click AUTHORIZE so the script can access the account on your behalf. This has to be done once for each script.
    Authorize a Google Ads Script
    Authorizing your new script
    1. Click PREVIEW to run the script in preview mode: Results will appear in the CHANGES / LOGS panel.

    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: AdsApp, SpreadsheetApp, AdsmanagerApp, and UrlFetchApp.

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

    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) 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 = AdsApp.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 = AdsApp.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:

    Anatomy of a Google Ads Script
    The annotations help translate the script – 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.

    Managing Google Ads Scripts in Bulk Actions
    The scripts window allows you to manage existing scripts and create new ones

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

    There are 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 are 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.

    There are 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). For the sake of this article, we only included the scripts that we find the most meaningful and useful for you the reader. 

    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:

    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 users’ search behavior. You can see an example of a click-through rate heat map below:

    Heat Maps Google Ads Script
    This shows some significant differences in CTR during certain hours and days – source

    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.

    Quality Score Google Ads Script
    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.

    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. 

    Zero Impressions Pause Google Ads Script
    Example of the "0" impressions pause script

    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

    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.

    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.

    N-Gram Google Ads 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.

    N-Gram Sheet of Google Ads Script
    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 number of keywords or search terms.

    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:

    24/7 Bidding Google Ads Script
    This spreadsheet would be the Object in your script – source

    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.

    Link Checker Google Ads Script
    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.

    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.

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

    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 set up your search lost IS (rank) filter as 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 that you’re willing to pay.

    The setup should look something like the screenshot below:

    Setting Up Filters for Google Ads Script
    Locating your filters and setting them up
    Setting Cost/Conv Filter For Google Ads Bid Increase Script
    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.

    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:

    Setting Up Filters for Decreasing Bids Google Ads Script
    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.

    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.

    Ad Spend Report Google Ads Script
    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.

    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 analyses 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.

    Ad AB Testing Google Ads Script
    Even better? There’s no editing needed for this script 🙂 – 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.

    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 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.

    Low CTR Ad Pausing Google Ads Script
    A real short snippet of code, at that – 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.

    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. Keep in mind that this is more for fun, as it is a pretty wild script, but there is use for it with some companies. 

    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:

    Bid By Weather Google Ads Script
    First, you’ll have to set up your campaign details – 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 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:

    Considered Parameters For Weather Google Ads Script
    These are some considered parameters for the script – 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.

    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. 🙂

    Changes In CTR Google Ads Script
    You can view the whole script on Evernote. – 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.

    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:

    Declining Ad Groups Report Google Ads Script
    This screenshot is for a multiple-account view – source

    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.

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

    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. 😉

    Chapter 11:
    Advanced Google Ads

    What You’ll Learn: Ready to nerd out? Here are some of the more advanced things you can do to improve the performance of your Google Ads account.