Build a GAQL Script to Auto-Pause Zero-Conversion Keywords
Stop wasting budget on underperforming keywords. Learn how to write and deploy a Google Ads GAQL script to auto-pause terms exceeding $200 with zero conversions.
By AdTurbo Team · 2026-10-17
Every dollar spent on non-converting traffic reduces your account's return on ad spend (ROAS) and starves your winning ad groups of critical budget. When you scale an account across dozens of campaigns and hundreds of ad groups, rogue search terms routinely slip through manual reviews. A keyword that looks promising in week one can quietly burn $250, $400, or more over the course of a month without generating a single recorded sale or lead.
While Google Ads provides native automated rules, native rules have notorious blind spots: rigid reporting windows, unreliable execution cadence, and limited filtering capabilities when managing multi-match-type structures. Implementing a custom gaql script pause high spend zero conversion mechanism via Google Ads Scripts provides precision control, automated safety buffers, and instant email alerting.
In this technical guide, you will learn how to write, configure, test, and deploy a production-grade Google Ads script powered by Google Ads Query Language (GAQL) to prune high-cost, zero-conversion keywords before they drain your quarterly budget.
---
Why Unchecked Non-Converting Keywords Drain Margins
Search campaigns are susceptible to spend leakage because bid algorithms prioritize click volume and auction participation over down-funnel profitability if target metrics are not tightly constrained. An unconstrained broad or phrase match keyword might maintain a respectable click-through rate while generating clicks that never convert.
The Math Behind Budget Erosion
Consider an account running 30 ad groups. If just five keywords per ad group accumulate $150 to $200 in click costs over a 60-day period without converting, the account incurs:
• 30 ad groups × 5 bleeding keywords = 150 non-converting targets
• 150 targets × $200 spend = $30,000 in direct wasted spend
If your target cost-per-acquisition (CPA) is $50, that single leakage vector forfeits 600 potential conversions that could have been acquired by reallocating that budget into top-tier converting assets. If you are struggling with account performance across the board, start by reviewing Google Ads Not Working? 11 Things to Check Before You Panic to see if foundational targeting errors are amplifying your spend loss.
Why Manual Negative Mining and Pausing Falls Short
Manual optimization cycles are naturally reactive. Most media buyers run weekly search term queries or bi-weekly keyword performance checks. In high-cost-per-click (CPC) verticals—such as legal services, B2B SaaS, and financial services—a keyword with a $25 CPC can hit a $200 spend threshold in just eight clicks across two days. Relying exclusively on manual log reviews leaves a multi-day exposure window where non-viable search queries burn budget unchecked.
Using a cut wasted spend script google ads workflow closes this time gap, checking metrics every morning and applying defensive actions autonomously.
---
GAQL vs Old AWQL: Understanding the Modern Scripts Architecture
With the deprecation of the legacy AdWords API and the transition to the modern Google Ads API infrastructure, Google Ads Scripts now run on Google Ads Query Language (GAQL). If your scripts still reference legacy AWQL syntax—such as WHERE Clicks 10 AND Conversions = 0 DURING LAST30DAYS—they will eventually fail or run on compatibility bridges.
How GAQL Modernizes Data Fetching
GAQL uses resource-oriented queries reminiscent of standard SQL. Instead of pulling flat reports, it fetches structured data entities (like keywordview, adgroupcriterion, or campaign) joined with their associated performance metrics.
Here is how core attributes compare between legacy approaches and GAQL:
| Feature / Attribute | Legacy AWQL (Deprecated) | Modern GAQL Engine | Script Advantage |
| :--- | :--- | :--- | :--- |
| Resource Scope | Flat report names (KEYWORDSPERFORMANCEREPORT) | Granular entity views (keywordview, adgroupcriterion) | Direct access to deep object attributes |
| Field Selectors | Comma-delimited uppercase attributes (Cost, Conversions) | Dot-notated snakecase fields (metrics.costmicros, metrics.conversions) | Explicit separation of metrics, segments, and metadata |
| Micro-Unit Handling | Returned costs as currency floats ($200.00) | Returns raw values in micros (200000000) | Eliminates floating-point rounding errors |
| Date Windows | String tokens in query (DURING LAST30DAYS) | segments.date DURING LAST30DAYS or explicit ranges | Supports custom rolling date ranges natively |
| Entity Mutability | Required complex mutate operations | Interoperable with native AdsApp.Keyword iterators | Faster execution and easier error handling |
Understanding micro-currency units is essential: Google Ads stores financial metrics in micros, where $1.00 equals 1,000,000 micros. A $200 spend threshold must be evaluated in your GAQL script as metrics.costmicros = 200000000.
---
Setting Safety Thresholds: Lookback Windows and Conversion Lag
Before deploying a google ads script auto pause non converting keywords routine, you must calibrate your thresholds. Pausing keywords prematurely can destroy campaigns by killing keywords that are in the middle of a multi-day consideration cycle.
Factoring in Conversion Lag
Conversion lag is the time elapsed between an ad click and the recorded conversion event. In eCommerce, lag might be 24 to 48 hours. In B2B enterprise software or high-ticket lead generation, lag can easily reach 14 to 30 days.
If you run a script that checks LAST7DAYS and pauses keywords with zero conversions, you will inadvertently pause keywords that drove clicks today whose leads will not complete your funnel until day twelve.
To prevent this, configure your script with these best practices:
1. Use a 30-Day to 60-Day Lookback Window: Evaluate performance over LAST30DAYS or LASTMONTH to allow attribution to close.
2. Exclude Recent Days: If using custom date filters, offset the query by 48-72 hours to prevent penalizing keywords with conversions currently processing in Google's attribution pipeline.
3. Base the Spend Threshold on Target CPA: A static $200 rule works well if your target CPA is $50 to $75 (representing 2.5x to 4x your target CPA). If your target CPA is $300, a $200 threshold will pause viable keywords before they have an opportunity to convert. Set your spend cutoff at a multiple of your actual CPA benchmark (typically 2x to 3x your acceptable target CPA).
For a broader audit of your account efficiency before turning on aggressive pause scripts, consult our PPC Audit Checklist: 12 Steps to Fix a Leaking Google Ads Account.
---
Step-by-Step Implementation: The Complete GAQL Pause Script
Below is a battle-tested, modular Google Ads script. It queries keywords across active campaigns, evaluates their lifetime or multi-day spend against a predefined dollar limit, confirms zero recorded conversions, applies a visual label for auditing, logs the action, and pauses the keyword.
The Source Code
javascript
/
• Auto-Pause High-Spend, Zero-Conversion Keywords via GAQL
• Target Threshold: Spend = $200 (200,000,000 micros) and Conversions == 0
/
const CONFIG = {
SPENDTHRESHOLDDOLLARS: 200,
DATERANGE: 'LAST30DAYS', // Options: LAST30DAYS, LAST14DAYS, or 'YYYY-MM-DD,YYYY-MM-DD'
APPLYLABEL: true,
PAUSELABELNAME: 'AutoPausedZeroConvHighSpend',
SENDEMAIL: true,
NOTIFICATIONEMAIL: '[email protected]',
DRYRUN: true // Set to false to actually execute pauses
};
function main() {
ensureLabelExists(CONFIG.PAUSELABELNAME);
const spendInMicros = CONFIG.SPENDTHRESHOLDDOLLARS 1000000;
const gaqlQuery =
SELECT
campaign.id,
campaign.name,
adgroup.id,
adgroup.name,
adgroupcriterion.criterionid,
adgroupcriterion.keyword.text,
adgroupcriterion.keyword.matchtype,
metrics.costmicros,
metrics.conversions
FROM keywordview
WHERE
campaign.status = 'ENABLED'
AND adgroup.status = 'ENABLED'
AND adgroupcriterion.status = 'ENABLED'
AND metrics.costmicros = ${spendInMicros}
AND metrics.conversions = 0
AND segments.date DURING ${CONFIG.DATERANGE}
;
const searchResults = AdsApp.search(gaqlQuery);
const pausedKeywords = [];
Logger.log(Executing query with spend limit: ${CONFIG.SPENDTHRESHOLDDOLLARS} (${CONFIG.DATERANGE}));
while (searchResults.hasNext()) {
const row = searchResults.next();
const campaignName = row.campaign.name;
const adGroupName = row.adGroup.name;
const keywordText = row.adGroupCriterion.keyword.text;
const matchType = row.adGroupCriterion.keyword.matchType;
const cost = (row.metrics.costMicros / 1000000).toFixed(2);
const criterionId = row.adGroupCriterion.criterionId;
const adGroupId = row.adGroup.id;
Logger.log(Found candidate: "${keywordText}" (${matchType}) in [${campaignName} ${adGroupName}] | Spend: ${cost} | Conversions: 0);
if (!CONFIG.DRYRUN) {
// Retrieve native keyword object using IDs to mutate status
const keywordIterator = AdsApp.keywords()
.withIds([[adGroupId, criterionId]])
.get();
if (keywordIterator.hasNext()) {
const keywordObject = keywordIterator.next();
keywordObject.pause();
if (CONFIG.APPLYLABEL) {
keywordObject.applyLabel(CONFIG.PAUSELABELNAME);
}
pausedKeywords.push({
campaign: campaignName,
adGroup: adGroupName,
keyword: keywordText,
cost: cost
});
}
} else {
pausedKeywords.push({
campaign: campaignName,
adGroup: adGroupName,
keyword: keywordText,
cost: cost
});
}
}
Logger.log(Execution complete. Total keywords identified: ${pausedKeywords.length});
if (CONFIG.SENDEMAIL && pausedKeywords.length 0) {
sendEmailNotification(pausedKeywords);
}
}
function ensureLabelExists(labelName) {
if (!CONFIG.APPLYLABEL) return;
const labelIterator = AdsApp.labels().withCondition(name = '${labelName}').get();
if (!labelIterator.hasNext()) {
AdsApp.createLabel(labelName, 'Applied automatically by Zero-Conversion GAQL Script', 'e74c3c');
Logger.log(Created label: ${labelName});
}
}
function sendEmailNotification(keywords) {
const mode = CONFIG.DRYRUN ? 'SIMULATION (DRY RUN)' : 'LIVE EXECUTION';
const subject = [Google Ads Script] ${keywords.length} Keywords Paused - ${mode};
let body = The high-spend, zero-conversion GAQL script executed with the following findings:\n\n;
body += Threshold: Spent = ${CONFIG.SPENDTHRESHOLDDOLLARS} with 0 conversions\n;
body += Mode: ${mode}\n\n;
body += Identified Keywords:\n;
keywords.forEach((k, index) = {
body += ${index + 1}. [${k.campaign}] [${k.adGroup}] "${k.keyword}" - Spent: ${k.cost}\n;
});
MailApp.sendEmail(CONFIG.NOTIFICATIONEMAIL, subject, body);
Logger.log(Alert notification sent to: ${CONFIG.NOTIFICATIONEMAIL});
}
How This Script Executes
1. Configuration Integrity: The CONFIG object centralizes your variables. You can easily modify your spend threshold, lookback parameters, notification recipients, and dry-run state.
2. GAQL Query Execution: keywordview gathers metrics at the keyword criterion level while verifying that campaign, ad group, and criterion statuses are all ENABLED.
3. Micros Arithmetic: Converts your whole-dollar parameter into Google Ads API micros to prevent syntax errors.
4. Audit Labeling: Creates and applies an AutoPausedZeroConvHighSpend tag to paused entities so team members can audit script decisions directly in the Google Ads UI.
5. Mail Notification: Summarizes every affected keyword and sends an alert directly to your inbox.
---
How to Install and Test the Script in Google Ads
Installing custom scripts in your Google Ads interface requires no software installations or external IDE setups. Follow this deployment process:
Step 1: Open the Script Manager
1. Sign in to your Google Ads account.
2. Click on the Tools and Settings (wrench icon) or Tools navigation menu in the left panel.
3. Under Bulk Actions, click Scripts.
4. Click the blue + button to create a new script.
Step 2: Authorize Permissions
Paste the code provided above into the script editor. Click Authorize at the bottom right. A Google OAuth prompt will appear. You must grant the script permission to manage ads and send emails via your connected Google Workspace account.
[Google Ads Workspace]
│
▼
[Authorize Script] ──▶ [Review Permissions] ──▶ [Grant Access]
│
▼
[Run Preview Mode (Dry Run: true)]
│
▼
[Inspect Logs & Verification Email]
│
▼
[Switch Dry Run: false & Schedule Daily]
Step 3: Run in Preview Mode
Never run an untested pause script in production mode immediately. Leave DRYRUN: true set inside the script configuration. Click Preview at the bottom of the screen.
Inspect the Changes and Logs tabs:
• The Changes tab will display zero modifications because DRYRUN prevents actual pausing.
• The Logs tab will print every keyword meeting your criteria, including its exact spend and ad group context.
• Verify that the script targets actual underperformers and does not flag essential branded or high-intent keywords.
Step 4: Schedule the Execution
Once you have validated the output, change DRYRUN: true to DRYRUN: false. Click Save.
Return to the main Scripts overview table. Under the Frequency column, select Daily and choose a run time early in the morning (e.g., 4:00 AM or 5:00 AM in your account's primary time zone). This ensures that non-converting keywords are paused before peak search volume begins each day.
---
Edge Cases: Brand Keywords, Match Types, and High-Ticket Leads
Automated scripts execute strictly based on code logic; they lack business context. If left unmanaged, strict cost-capping scripts can inadvertently harm your account. Pay close attention to these three edge cases:
1. Branded Keywords and Identity Protection
Branded search keywords may occasionally see a temporary conversion dip due to tracking disconnects, tag failures, or landing page updates. If your branded campaign burns through $200 with zero tracked conversions because your primary lead form webhook failed, an automated script will shut down your brand keyword. Competitors bidding on your brand name will immediately capture your brand traffic.
Solution: Add a naming filter to your GAQL query to exclude branded campaigns:
sql
AND campaign.name NOT LIKE '%Brand%'
AND campaign.name NOT LIKE '%Protected%'
To understand competitive brand defense dynamics, read our deep-dive on Can You Bid on Competitor Brand Keywords in Google Ads?.
2. High-Ticket B2B Funnels
If you sell high-value enterprise products where a closed deal yields $20,000 in gross margin, your allowable target CPA might be $800 to $1,200. Pausing a keyword after spending $200 with zero conversions is premature in this context; it effectively guarantees you will never gather enough statistical data to find winners.
Rule of Thumb: Always align SPENDTHRESHOLDDOLLARS to the specific economics of the campaign. For enterprise lead generation, consider raising the threshold to $600 or evaluating performance across a 90-day window instead of 30 days.
3. Broad Match vs Exact Match Strategy
When a Broad Match keyword spends $200 with zero conversions, it usually indicates that broad match expansion has wandered into irrelevant search queries. In this case, pausing the keyword is the correct action.
However, when an Exact Match keyword spends $200 with zero conversions, it indicates that the core message or landing page offer fails to resonate with high-intent searchers. Instead of merely pausing the keyword, you must review the landing page experience, pricing clarity, and form friction. Discovering what queries actually triggered your spend can be streamlined using our guide on the Google Ads Search Terms Report.
---
Scripts vs Native Automated Rules vs Full Automation Platforms
Automating keyword management can be achieved through multiple methods. Choosing between basic native rules, GAQL scripts, and full machine-learning platforms depends on your account complexity, team capabilities, and monthly ad spend.
Comparative Architecture
| Capability | Native Google Ads Rules | Custom GAQL Scripts | Intelligent AI Platforms (e.g. AdTurbo) |
| :--- | :--- | :--- | :--- |
| Setup Difficulty | Low (Point-and-click UI) | Medium (Basic JavaScript/GAQL) | Zero code (Autonomous engine) |
| Lookback Flexibility | Rigid pre-set date ranges | Custom micro-second date ranges | Continuous multi-window attribution analysis |
| Context Awareness | None (Binary logic) | Moderate (Based on custom code filters) | High (Multi-layered intent & revenue modeling) |
| Maintenance Required| Periodic manual reviews | Script & API maintenance | Autonomous self-updating rules |
| Multi-Tier Logic | Single-tier triggers only | Advanced nested logic & webhooks | Holistic account optimization |
| Safety Circuit Breakers | None | Manual custom scripts | Built-in anomaly detection |
Native automated rules are useful for simple binary tasks, but they lack custom alerting hooks and cannot perform cross-resource joins via API. GAQL scripts bridge this gap, giving programmatic teams fine-grained control over execution logic without requiring external software licenses.
However, static scripts also have limitations: they operate strictly on hardcoded thresholds. If seasonal conversion rates drop across an entire industry, a script will aggressively pause keywords that might rebound the following week. This is where dedicated platforms deliver superior results. For teams seeking comprehensive governance without maintaining custom codebases, AdTurbo's Google Ads AI agent provides continuous, multi-factor bid and keyword optimization (available at $149/mo with a 7-day trial; credit card required).
---
Advanced Customizations: Slack Webhooks and Search Term Extraction
Once your base script is operational, you can extend its functionality to align with modern agency and operational workflows.
1. Direct Slack Webhook Notifications
Instead of sending internal emails that can get buried in inbox folders, configure the script to push alerts directly to your team's Slack channel via an incoming webhook:
javascript
function sendSlackAlert(pausedList) {
const webhookUrl = 'https://hooks.slack.com/services/YOUR/WEBHOOK/URL';
let text = 🚨 Google Ads Alert: ${pausedList.length} High-Spend Keywords Paused\n;
pausedList.forEach(item = {
text += • ${item.keyword} in ${item.campaign} (Spent: ${item.cost})\n;
});
const payload = {
text: text,
username: 'Ads Budget Guard',
iconemoji: ':moneywithwings:'
};
const options = {
method: 'post',
contentType: 'application/json',
payload: JSON.stringify(payload)
};
UrlFetchApp.fetch(webhookUrl, options);
}
2. Auto-Adding Exact Match Negatives to Preserve Campaign Structure
In single-theme ad group strategies, simply pausing a non-converting phrase keyword can cause Google to route those queries to another phrase or broad match keyword in your account. To prevent this, your script can add the offending keyword as a campaign-level negative keyword at the same time it pauses the ad group criterion.
Pairing proactive scripts with systematic negative lists guarantees that wasted budget is removed permanently. If you need inspiration for common waste categories, explore our reference guide on Negative Keywords: 100+ Examples and Lists for Google Ads.
If you run into issues managing complex keyword logic or want to transition from basic scripts to scalable automation, check out our guide on How to Manage Google Ads (Without Becoming a PPC Expert).
---
Related Guides
• PPC Audit Checklist: 12 Steps to Fix a Leaking Google Ads Account
• Google Ads Optimization Checklist: 15 Things to Check Every Week
• How to Use the Google Ads Search Terms Report to Cut Wasted Spend
---
Frequently Asked Questions
Will pausing a keyword via script negatively impact Quality Score?
Pausing a keyword does not retroactively damage your account's Quality Score, as paused keywords stop accumulating performance data. The historical click-through rate and Quality Score data remain frozen for that specific entity. Pausing non-converting, low-CTR keywords can help protect your account's overall Quality Score by directing future impressions to higher-relevance queries.
How often should this GAQL script run?
Running the script once daily during early morning hours (between 3:00 AM and 5:00 AM account time) is the recommended cadence. Running the script multiple times per day is unnecessary, as Google's conversion reporting pipeline requires several hours to process and attribute conversion events.
Can this script be used across a Google Ads MCC (Manager Account)?
Yes, but it requires wrapping the logic within the AdsManagerApp selector instead of AdsApp. You will iterate through child accounts using AdsManagerApp.accounts().get(), select each account via AdsManagerApp.select(account), and then execute the core keyword evaluation loop across each managed property.
What happens if a keyword's conversions report late due to attribution lag?
If a conversion attributes to a keyword after the script has paused it, the conversion will still appear in your Google Ads conversion reports. Because the script applies a custom label (e.g., AutoPausedZeroConvHighSpend), you can periodically run a secondary script or manual filter to identify paused keywords that subsequently recorded delayed conversions, allowing you to unpause them.