How to Use Scripts and Automated Rules to Manage Match Types in Google Ads
Learn how to use scripts or rules to manage match types in Google Ads by automating keyword promotions, demotions, and structural cleanup across campaigns. This step-by-step guide covers both automated rules for simple conditional logic and JavaScript-based scripts for complex bulk workflows, eliminating the need for manual intervention.
TL;DR: Google Ads scripts and automated rules let you programmatically control match types across campaigns—promoting high-performing broad match terms to phrase or exact, demoting underperformers, and keeping your keyword structure clean without manual intervention. This guide walks through exactly how to set that up, step by step.
If you've ever stared at a bloated search terms report wondering why your broad match keywords are burning budget on completely irrelevant queries, you already understand the problem. Match type management is one of those tasks that sounds simple but gets messy fast—especially when you're managing multiple campaigns or client accounts.
The good news: Google Ads gives you two built-in automation tools to help. Automated Rules handle simple conditional logic (if CPA exceeds X, do Y). Scripts give you full programmatic control using JavaScript, which is useful for more complex match type workflows like bulk promotions, demotions, or cross-campaign audits.
This guide is written for marketers, freelancers, and agency owners who are comfortable in Google Ads but haven't yet tapped into scripts or rules for match type management. You don't need to be a developer to follow along. Most of the script examples referenced here are well-documented and widely used in the PPC community.
By the end, you'll know how to set up automated rules for basic match type triggers, use scripts to promote search terms to exact or phrase match, audit your match type distribution automatically, and layer in safeguards to avoid over-automating. We'll also cover where tools like Keywordme can handle a lot of this without writing a single line of code.
Step 1: Understand What You're Actually Automating
Before you touch a single rule or script, get clear on what you're trying to automate. In most accounts I audit, people jump straight to building automation without mapping out the actual workflow first—and that's where things go sideways.
There are three core match type management tasks worth automating:
Promoting search terms to keywords: When a search term is converting well inside a broad or phrase match campaign, you want to add it as an exact match keyword so you can control it more precisely and bid on it intentionally.
Demoting or pausing underperforming broad match keywords: Broad match keywords that are generating high spend with poor conversion rates are worth pausing or flagging for review. Leaving them running unchecked is one of the fastest ways to drain budget.
Auditing match type distribution across campaigns: Over time, accounts drift. You end up with 80% of your keywords on broad match without realizing it. A regular audit keeps your structure intentional.
Now, which tool fits which job?
Automated Rules use simple if/then logic and require zero coding. They're built into the Google Ads interface under Tools and Settings. They work well for single-condition triggers like pausing a keyword when CPA exceeds a threshold or CTR drops below a floor. The limitation is real: Automated Rules cannot add new keywords or change the match type of an existing keyword. They can pause, enable, or adjust bids—that's it.
Scripts are JavaScript-based and run inside the Google Ads scripting environment. They have full access to your account data and can actually add new keywords at a specified match type, read the search terms report programmatically, and output reports to Google Sheets. The tradeoff is complexity. You'll need to read and understand the code, even if you're adapting a pre-built script rather than writing from scratch.
A common pitfall here: automating match type changes before running a baseline audit of your current keyword structure in PPC campaigns. If you don't know what you're starting with, automation can make the mess worse. Run a match type audit first—even a manual one—before deploying any rules or scripts.
Step 2: Set Up Automated Rules for Basic Match Type Triggers
Automated Rules are the right starting point if you want to flag underperforming broad match keywords without writing any code. Here's how to set one up.
Navigate to Tools and Settings > Bulk Actions > Rules in your Google Ads account. Click the blue plus button to create a new rule. Set the rule type to Keywords.
A practical example: pausing broad match keywords that are generating impressions but not clicking through. Here's the exact structure to use:
Apply to: All keywords (or a specific campaign if you want to scope it)
Action: Pause keyword
Conditions: Match type = Broad, CTR < 1% (adjust based on your account benchmarks), Impressions > 500 (this ensures you're working with a meaningful data sample, not reacting to noise)
Frequency: Weekly, on Monday mornings, so you start each week with a clean slate
Email notification: Turn this on. You want a record of what fired.
Before you save and activate, always click Preview first. This shows you which keywords would be affected by the rule right now, without actually making any changes. In most accounts I've set this up in, the preview catches at least one condition that needs adjusting—usually the impression threshold is too low or the CTR floor is too aggressive.
Here's the important caveat to understand: this rule pauses the keyword, but it doesn't promote a better version. You're using the rule to stop the bleeding. The actual match type change—adding the search term as an exact match keyword—still needs to happen separately, either manually or via script.
What usually happens here is that teams set up the rule, watch it pause a handful of keywords each week, and then forget to follow through with the promotion step. The rule becomes a one-way door: keywords get paused but nothing better replaces them. Build a weekly review habit alongside any rule you deploy. For a deeper look at how to configure these triggers effectively, see this guide on using rules in Google Ads.
For bid adjustments based on match type performance, Automated Rules are more capable. You can set up a rule to increase bids on exact match keywords that are converting below target CPA, or decrease bids on phrase match keywords with declining quality scores. These bid-level rules work well as a complement to your match type management workflow.
Step 3: Use Google Ads Scripts to Promote Search Terms to Exact Match
This is where the real automation happens. Scripts can actually read your search terms report and add high-performing terms as new exact match keywords—something Automated Rules simply can't do.
The core logic of a search term promotion script works like this:
1. Pull all search term data from a defined date range using AdsApp.search() with a GAQL query targeting the search_term_view resource.
2. Iterate over each row and check performance conditions. A typical threshold might be: conversions >= 2 AND cost < target CPA AND the term isn't already an exact match keyword in the ad group.
3. For terms that pass the filter, call adGroup.newKeywordBuilder().withText('[term]').withMatchType('EXACT').build() to add the keyword.
4. Simultaneously, add the same term as a negative keyword in the original broad or phrase match ad group to prevent cannibalization. This step gets skipped more often than it should, and it's the reason match type promotion scripts create duplicate auction problems. Understanding how to stop cannibalization across match types is essential before deploying any promotion script.
Here's a pseudocode walkthrough of the core structure:
// Query search terms with conversion data
var query = "SELECT search_term_view.search_term, metrics.conversions, metrics.cost_micros, ad_group.resource_name FROM search_term_view WHERE segments.date DURING LAST_30_DAYS";
var rows = AdsApp.search(query);
while (rows.hasNext()) { var row = rows.next(); // check thresholds, then add keyword }
You don't need to write this from scratch. The Google Ads Scripts documentation at solutions.google.com/ads/scripts has well-maintained examples. Optmyzr's script library and PPC Hero's script archives are also solid resources with community-tested versions of this exact workflow. Adapting an existing script is far more practical than building one from zero, especially if JavaScript isn't your primary language. For a broader look at what's possible, the guide on using scripts to manage keywords covers additional use cases worth reviewing.
One pitfall that catches people: promoting too aggressively on low data. If you set your threshold at conversions >= 1, you'll end up adding dozens of keywords based on single-conversion flukes. Most experienced PPC managers set a minimum of 2-3 conversions and a meaningful impression floor before promoting. The goal is to identify genuinely repeatable patterns, not react to one-off events.
Also worth noting: in 2025 and 2026, broad match behavior has continued to evolve. Google's broad match now uses audience signals, landing page context, and search history to expand reach—which means the search terms it matches can drift further from your original keyword intent than they did a few years ago. This makes automated promotion scripts more valuable, not less, because the volume of terms worth reviewing has grown.
Step 4: Build a Match Type Audit Script to Monitor Distribution
Knowing what percentage of your keyword spend is flowing through broad versus phrase versus exact match is one of the most underused diagnostic checks in account management. Most teams only look at this when something goes wrong. A scheduled audit script flips that: you get a weekly snapshot without any manual effort.
The structure of a match type audit script is simpler than the promotion script. Here's the core logic:
1. Iterate over all campaigns and ad groups using AdsApp.campaigns().get() and campaign.adGroups().get().
2. For each ad group, pull all keywords and group them by match type.
3. Pull spend data for each keyword and aggregate it by match type across the account.
4. Write the output to a Google Sheet using SpreadsheetApp.openByUrl(), with columns for campaign, ad group, match type, keyword count, and spend share.
5. Schedule the script to run weekly via the Scripts scheduler, and add an email notification so the output lands in your inbox automatically.
What does a healthy distribution look like? It genuinely varies by account type and strategy. A brand campaign running mostly exact match makes sense. A discovery-focused campaign with intentional broad match also makes sense. The point of the audit isn't to hit a specific ratio—it's to spot drift. If your exact match spend share drops significantly week over week without a deliberate change, that's a signal worth investigating. Knowing how to refine match types over time gives you a framework for acting on what these audits surface.
For agencies managing multiple client accounts, MCC-level scripts are a significant efficiency gain here. A single script running at the Manager Account level can generate a match type health report across all client accounts simultaneously. You write the logic once, schedule it once, and get a consolidated weekly view across your entire book of business. That's the kind of leverage that makes the upfront script investment worthwhile.
The output format matters too. A Google Sheet with a new tab per week gives you a historical record you can compare over time. Add conditional formatting to flag ad groups where broad match spend share exceeds a threshold you define, and the report becomes a prioritized action list rather than just a data dump.
Step 5: Add Safeguards So Automation Doesn't Break Your Campaigns
The biggest risk with match type automation isn't that it won't work—it's that it'll work too well, too fast, without enough data to back it up. Here are the five safeguards every match type script should include.
Safeguard 1: Set minimum data thresholds. Never promote a search term with fewer than a meaningful number of impressions or clicks. What counts as meaningful depends on your account volume, but erring on the side of more data is almost always the right call. Scripts that fire on thin data create noise, not signal.
Safeguard 2: Build a duplicate check. Before adding a new keyword, query the existing keywords in the target ad group to confirm the term doesn't already exist. Adding duplicates creates auction confusion and can inflate CPCs. A simple existence check before the build() call prevents this entirely.
Safeguard 3: Use dry-run mode. Add a boolean flag at the top of your script—something like var DRY_RUN = true;—and wrap all write operations in a conditional that logs the intended change to a spreadsheet instead of executing it. Run the script in dry-run mode for a week before going live. This gives you a human review checkpoint before anything touches your account.
Safeguard 4: Cap changes per execution. Set a hard limit on how many keywords the script can add or pause in a single run. If something goes wrong with your logic, a cap prevents a bulk error from cascading through your entire account. Twenty to fifty changes per run is a reasonable starting range for most accounts.
Safeguard 5: Keep a changelog in Google Sheets. Every change the script makes should be logged with a timestamp, the keyword affected, the action taken, and the ad group it was applied to. This changelog is your audit trail. When a client asks why a keyword was paused three weeks ago, you'll have the answer in thirty seconds instead of thirty minutes. Pairing this with a clear process for pausing underperforming keywords ensures your safeguards and manual reviews work together seamlessly.
Step 6: Skip the Code Entirely with In-Interface Match Type Management
Scripts are powerful, but they come with real overhead. You need to understand the code well enough to adapt it, debug it when it breaks, and maintain it as Google's API evolves. For many marketers, freelancers, and agency owners, that's a cost that doesn't make sense—especially for accounts where the optimization workflow is better handled by a human making fast, informed decisions rather than a script running on a schedule.
This is exactly where Keywordme fits. It's a Chrome extension that works directly inside the Google Ads Search Terms Report, so you never leave the native interface. Instead of exporting to a spreadsheet or building script logic, you filter your search terms, identify high-intent queries, and add them as exact or phrase match keywords to the right ad group with a click. Irrelevant terms get added as negatives just as fast.
The practical workflow looks like this: open your Search Terms Report in Google Ads, use Keywordme to filter and surface the terms worth acting on, click to promote the high-performers to exact or phrase match, and add the junk terms to your negative keyword list—all without switching tabs or touching a spreadsheet. For an optimization session that would normally take 45 minutes with a spreadsheet workflow, this approach cuts it down significantly. If you want to understand how to get more from the Search Terms Report itself, this guide on optimizing match types using the search terms report is worth reading alongside this workflow.
The comparison between the two approaches is worth being clear about. Scripts are better for fully automated, scheduled workflows across large accounts where you want changes to happen without anyone sitting at a keyboard. Keywordme is better for fast, human-in-the-loop optimization sessions where judgment matters—where you want to review terms before acting on them rather than delegating that decision to code.
For agencies managing multiple client accounts, Keywordme's multi-account support means you can run this workflow across clients efficiently without rebuilding your process for each account. It's the same interface, the same clicks, just a different account selected. For more on managing this at scale, see the guide on managing multiple Google Ads accounts efficiently.
The honest take: for most accounts under a few hundred thousand dollars in monthly spend, Keywordme's in-interface approach covers the majority of match type management needs without any scripting overhead. Scripts become the right call when you're managing at scale, running MCC-level audits, or want fully hands-off automation between optimization sessions.
Putting It All Together: Your Match Type Automation Checklist
Here's the full workflow in a format you can actually use:
Audit first: Run a match type distribution check before setting up any automation. Know your starting point.
Define your thresholds: Set your promotion criteria (minimum conversions, maximum CPA) and demotion criteria (minimum impressions, maximum CPA) before writing a single rule or script.
Set up Automated Rules for bid and pause triggers: Use rules for simple if/then actions on existing keywords. Always preview before activating.
Deploy a search term promotion script with safeguards: Include dry-run mode, duplicate checks, data thresholds, and a change cap. Log everything to a Google Sheet.
Schedule a weekly match type audit script: Output to Google Sheets, enable email notifications, and review the report every Monday.
Review the script changelog weekly: Automation handles scale; your judgment handles edge cases. Don't set it and forget it entirely.
Use Keywordme for fast optimization sessions in between: For the terms that need a human eye before acting on them, in-interface management is faster and safer than script logic.
Frequently Asked Questions
Can automated rules change match types directly? No. Google Ads Automated Rules can pause, enable, or adjust bids on existing keywords, but they cannot add new keywords or change the match type of an existing one. For actual match type changes, you need scripts or manual action.
What's the difference between a script and an automated rule in Google Ads? Automated Rules use a simple conditional interface built into Google Ads—no coding required, limited to bid and status changes. Scripts are JavaScript programs that run inside the Google Ads scripting environment and have full read/write access to your account data, including the ability to add new keywords at any match type.
How do I prevent duplicate keywords when promoting search terms? Before adding a new keyword in your script, query the existing keywords in the target ad group and check whether the term already exists at the intended match type. Only proceed with the build call if no match is found. Also add the promoted term as a negative in the source ad group to prevent cannibalization.
How often should I run match type management scripts? Weekly is the standard cadence for most accounts. Running more frequently on low-volume accounts means you're acting on thin data. For high-volume accounts generating thousands of search terms daily, a more frequent schedule can make sense—but always pair it with higher data thresholds to compensate.
If you'd rather skip the scripting entirely and manage match types directly inside Google Ads, Start your free 7-day trial of Keywordme. It's built for exactly this workflow: fast, in-interface optimization without spreadsheets, without code, and without switching tabs. After the trial, it's $12/month per user—straightforward pricing for a tool that pays for itself quickly in time saved and wasted spend recovered.