Auto Exclude Zero Conversion Queries: Custom Google Ads Script

Build a custom Google Ads script to auto exclude zero conversion queries with 100+ clicks and no revenue. Stop search term budget waste automatically.

By AdTurbo Team · 2026-10-14

Every dollar you spend on Google Ads should either generate direct revenue or buy statistically valid data that informs future optimization. Unfortunately, accounts running broad match or phrase match targeting often hemorrhage cash on search terms that rack up dozens—or even hundreds—of clicks without ever generating a single sale, lead, or dollar of conversion value.

While running manual search term audits is a standard best practice, doing it by hand every week is tedious, error-prone, and slow. By the time you notice an offending query in the Search Terms report, it may have already consumed $300 to $800 of your advertising budget.

Building an automated script to auto exclude zero conversion queries solves this problem permanently. In this comprehensive technical guide, we will break down the math behind query exclusion thresholds, provide a production-ready Google Ads script using modern Google Ads Query Language (GAQL), walk through safe deployment procedures, and examine when scripts reach their technical limits.

---

Why Unchecked Search Terms Drain PPC Budgets

Google's push toward broad match targeting combined with Smart Bidding has transformed keyword management. While broad match algorithms claim to interpret user intent, search term matching in practice frequently pairs your high-intent keywords with loosely related informational, job-seeker, or exploratory queries.

When these queries enter your account, they rarely generate a sudden spike of 500 clicks in a day. Instead, they produce a low-level trickle: three clicks on Tuesday, two on Friday, four the following Monday. Because the spend is diffused across weeks or months, manual account managers easily miss them.

Search Term Lifecycle Without Automation:

[Day 1: 3 Clicks ($12)] - [Day 14: 35 Clicks ($140)] - [Day 45: 102 Clicks ($408, $0 Rev)] - [Manual Audit catches it]

^

Automation catches query here |

The Mathematical Case for the 100-Click Threshold

Why set the baseline threshold at 100 clicks and zero revenue? The answer lies in basic conversion probability and statistical confidence.

If your landing page converts at an average rate of 3%, the probability ($P$) of a valid, converting search query receiving $n$ clicks without a single conversion is modeled by the binomial distribution:

$P(0 \text{ conversions}) = (1 - p)^n$

Where:

• $p$ is your expected conversion rate ($0.03$)

• $n$ is the number of clicks ($100$)

Calculating this:

$P(0 \text{ conversions}) = (1 - 0.03)^{100} = (0.97)^{100} \approx 0.04755 \text{ (4.75%)}$

This means there is less than a 4.8% chance that a search term with a true 3% conversion rate would produce zero conversions across 100 clicks. In statistical hypothesis testing terms, you can reject the null hypothesis that this query is a viable converting term at the 95% confidence level ($p < 0.05$). Allowing that query to accrue a 101st click is mathematically unjustified.

Calculating the Cumulative Financial Bleed

Consider an account running an average Cost Per Click (CPC) of $3.50. A single query that accrues 100 clicks without a conversion costs you $350.

If your account triggers 20 such rogue queries across different ad groups over a 90-day window, that amounts to $7,000 in pure financial waste. If that money were redirected to your top-quartile converting search queries yielding a 4x Return on Ad Spend (ROAS), that $7,000 could have generated $28,000 in gross revenue. Conducting a regular PPC audit checklist reveals that this invisible friction accounts for between 12% and 28% of total budget allocation in unmonitored accounts.

---

Prerequisites and Architecture of the Google Ads Script

Google Ads Scripts run on a lightweight JavaScript environment directly inside the Google Ads platform. With Google's migration to the newer Google Ads API infrastructure, scripts utilize Google Ads Query Language (GAQL) to fetch metrics efficiently using streams.

Before deploying your google ads script negative search terms waste automation, you need to understand how the script queries data and where it applies negative keywords.

GAQL Architecture for Search Term Reporting

The script queries the searchtermview resource. This view exposes metrics attributed to the specific query string typed by the user, rather than the parent keyword configured in your ad group. The core query metrics we need to evaluate include:

• searchtermview.searchterm: The exact text entered by the user.

• metrics.clicks: Total clicks registered during the lookback window.

• metrics.conversions: Direct and assisted conversion counts.

• metrics.conversionsvalue: Total monetary value generated (essential for e-commerce stores tracking actual revenue).

• campaign.id and adgroup.id: Target locations for scoping negatives.

+-------------------------------------------------------------+

| Google Ads Script Engine |

| |

| 1. GAQL Query --- searchtermview (Clicks = 100) |

| 2. Revenue Filter --- conversionsvalue == 0 |

| 3. Whitelist Check --- Check against Brand/Protected List |

| 4. Execution --- Add [exact match] to Negative List/Group |

| 5. Audit Log --- Append row to Google Sheet |

+-------------------------------------------------------------+

Account-Level Shared Lists vs. Ad Group Negatives

When a script identifies a zero-conversion query, you have two architectural choices for where to push the negative keyword:

1. Shared Account-Level Negative Keyword List: This blocks the query across every search campaign in your account. This is the preferred approach for universally irrecoverable queries (e.g., searches containing words like "free download", "login", or competitor services you explicitly do not handle).

2. Ad Group-Level Exact Negatives: This blocks the query only within the specific ad group where it triggered, leaving open the possibility that a more relevant ad group with a tailored landing page could convert it.

For a general "100 clicks / zero revenue" rule, applying an [exact match] negative at the campaign or negative keyword list level is standard practice, because any query failing to convert after 100 clicks across any landing page in that campaign has demonstrably failed your traffic qualification tests. If you are unfamiliar with foundational negative structure, review our guide on how to find negative keywords.

---

The Complete Script to Auto Exclude Zero Conversion Queries

Below is the complete, production-ready script. It contains safety controls: a lookback window setting, a minimum click threshold, a dry-run toggle (CONFIG.DRYRUN), a maximum execution limit to prevent API timeouts, and a brand safety exclusion list.

javascript

/

• Auto-Exclude Zero-Conversion Search Queries Script

• Target: Excludes queries exceeding click threshold with 0 revenue/conversions

• Version: 2.1 (GAQL / Modern Scripting Engine Compatible)

/

const CONFIG = {

// Minimum clicks before evaluating conversion performance

CLICKTHRESHOLD: 100,

// Lookback duration in days (LAST30DAYS, LAST90DAYS, or custom integer)

LOOKBACKDAYS: 60,

// Evaluation criteria: 'CONVERSIONS' or 'REVENUE'

// 'REVENUE' checks conversionsvalue <= 0; 'CONVERSIONS' checks conversions <= 0

CRITERIA: 'REVENUE',

// Set to true to log actions in the console without actually adding negatives

DRYRUN: true,

// Name of a Shared Negative Keyword List to append exclusions to.

// Set to '' if you prefer ad-group level negative exclusions.

SHAREDLISTNAME: 'Automated Script Exclusions',

// Brand terms or tokens that should NEVER be excluded, even with 0 conversions

PROTECTEDTOKENS: ['mybrand', 'brandname', 'mytargetkeyword'],

// Campaigns to explicitly exclude from the script (case-insensitive substrings)

CAMPAIGNEXCLUSIONPATTERNS: ['brand', 'competitor', 'test']

};

function main() {

Logger.log('Starting Auto-Exclude Search Terms Script...');

Logger.log('Mode: ' + (CONFIG.DRYRUN ? 'DRY RUN (No changes made)' : 'LIVE EXECUTION'));

let sharedList = null;

if (CONFIG.SHAREDLISTNAME && !CONFIG.DRYRUN) {

sharedList = getOrCreateNegativeList(CONFIG.SHAREDLISTNAME);

}

const dateRangeString = calculateDateRange(CONFIG.LOOKBACKDAYS);

const gaqlQuery = buildSearchTermQuery(dateRangeString);

const searchResults = AdsApp.search(gaqlQuery);

let processedCount = 0;

let excludedCount = 0;

while (searchResults.hasNext()) {

const row = searchResults.next();

const searchTerm = row.searchTermView.searchTerm.trim();

const campaignId = row.campaign.id;

const campaignName = row.campaign.name;

const adGroupId = row.adGroup.id;

const clicks = row.metrics.clicks;

const conversions = row.metrics.conversions;

const conversionValue = row.metrics.conversionsValue;

processedCount++;

// Verify campaign exclusion patterns

if (isCampaignExcluded(campaignName)) {

continue;

}

// Verify brand protection

if (isProtectedTerm(searchTerm)) {

Logger.log(Skipping protected term: "${searchTerm}" (${clicks} clicks));

continue;

}

// Qualification check

const shouldExclude = CONFIG.CRITERIA === 'REVENUE'

? (conversionValue <= 0)

: (conversions <= 0);

if (shouldExclude) {

excludedCount++;

Logger.log([TARGET FOUND] "${searchTerm}" | Clicks: ${clicks} | Value: ${conversionValue} | Campaign: ${campaignName});

if (!CONFIG.DRYRUN) {

applyNegative(searchTerm, campaignId, adGroupId, sharedList);

}

}

}

Logger.log('--------------------------------------------------');

Logger.log(Finished processing. Total terms evaluated: ${processedCount});

Logger.log(Total queries marked for exclusion: ${excludedCount});

if (CONFIG.DRYRUN) {

Logger.log('REMINDER: Script ran in DRYRUN mode. Set CONFIG.DRYRUN = false to enforce.');

}

}

function buildSearchTermQuery(dateRange) {

return

SELECT

searchtermview.searchterm,

campaign.id,

campaign.name,

adgroup.id,

metrics.clicks,

metrics.conversions,

metrics.conversionsvalue

FROM searchtermview

WHERE

metrics.clicks = ${CONFIG.CLICKTHRESHOLD}

AND segments.date BETWEEN '${dateRange.startDate}' AND '${dateRange.endDate}'

AND campaign.status = 'ENABLED'

AND adgroup.status = 'ENABLED'

ORDER BY metrics.clicks DESC

;

}

function applyNegative(term, campaignId, adGroupId, sharedList) {

const formattedTerm = [${term}]; // Exact match negative

if (sharedList) {

try {

sharedList.addNegativeKeyword(formattedTerm);

Logger.log(- Added ${formattedTerm} to shared list: ${CONFIG.SHAREDLISTNAME});

} catch (e) {

Logger.log(- Error adding to shared list: ${e.message});

}

} else {

try {

const adGroupIterator = AdsApp.adGroups().withIds([adGroupId]).get();

if (adGroupIterator.hasNext()) {

const adGroup = adGroupIterator.next();

adGroup.createNegativeKeyword(formattedTerm);

Logger.log(- Added ${formattedTerm} to Ad Group: ${adGroup.getName()});

}

} catch (e) {

Logger.log(- Error adding to ad group: ${e.message});

}

}

}

function isProtectedTerm(term) {

const lower = term.toLowerCase();

return CONFIG.PROTECTEDTOKENS.some(token = lower.includes(token.toLowerCase()));

}

function isCampaignExcluded(campaignName) {

const lower = campaignName.toLowerCase();

return CONFIG.CAMPAIGNEXCLUSIONPATTERNS.some(pat = lower.includes(pat.toLowerCase()));

}

function calculateDateRange(numDays) {

const end = new Date();

end.setDate(end.getDate() - 1); // Exclude today to prevent incomplete attribution

const start = new Date();

start.setDate(start.getDate() - numDays);

return {

startDate: Utilities.formatDate(start, AdsApp.currentAccount().getTimeZone(), 'yyyy-MM-dd'),

endDate: Utilities.formatDate(end, AdsApp.currentAccount().getTimeZone(), 'yyyy-MM-dd')

};

}

function getOrCreateNegativeList(listName) {

const iter = AdsApp.negativeKeywordLists().withCondition(Name = '${listName}').get();

if (iter.hasNext()) {

return iter.next();

}

const builder = AdsApp.newNegativeKeywordListBuilder();

const operation = builder.withName(listName).build();

return operation.getResult();

}

Critical Logic Breakdown

1. Exact Match Wrapping ([term]): The script deliberately encloses target queries in brackets ([${term}]). When you identify that affordable cloud backup software reviews has 112 clicks and 0 conversions, you want to kill that specific phrase variant. You do not want to add cloud backup as a broad negative, which would destroy valid converting traffic elsewhere in the account.

2. Date Offset by 1 Day (setDate(end.getDate() - 1)): The query excludes the current calendar day. Intraday conversion latency can mean clicks that happened two hours ago haven't registered conversions yet. Evaluating today's traffic prematurely causes false-positive negatives.

3. The Protected Tokens Safeguard: If you sell enterprise cybersecurity under the brand name "ShieldNet", you do not want your brand terms flagged if an unlinked tracking pixel causes a temporary 48-hour conversion reporting drop. The PROTECTEDTOKENS array prevents the script from touching critical queries.

---

Step-by-Step Installation and Testing in Google Ads

Running raw code in a production ad account requires caution. An untested script executing bad logic can add thousands of negative keywords, completely zeroing out your daily ad impressions. Follow this step-by-step deployment protocol.

Deployment Flow:

+--------------------+

| Paste Script in UI |

+---------+----------+

|

v

+--------------------+

| Set DRYRUN = true |

+---------+----------+

|

v

+--------------------+

| Click "Preview" | --- Inspect Logs (Verify queries, zero conversions)

+---------+----------+

|

v

+---------------------+ No

| Target List Accurate?| -------- Adjust CONFIG parameters

+---------+-----------+

| Yes

v

+----------------------+

| Set DRYRUN = false |

+---------+------------+

|

v

+----------------------+

| Schedule Execution | (e.g., Weekly on Mondays at 03:00)

+----------------------+

Step 1: Access the Scripts Management Interface

1. Log into your Google Ads account.

2. In the top navigation bar, click on Tools and Settings (the wrench icon) or navigate to the left-hand navigation if you are using the redesigned interface.

3. Under the Bulk Actions column, click Scripts.

4. Click the blue + button to create a new script.

Step 2: Authorize Permissions

Google Ads Scripts run within Google's cloud infrastructure and require explicit OAuth authorization:

• Click the Authorize button displayed in the blue warning banner.

• Select your Google account that owns administrative privileges on the ad account.

• Click Allow when prompted for Google Ads API access.

Step 3: Configure and Run in Preview Mode

Paste the script code into the script editor. Before running, configure the CONFIG object:

• Confirm CONFIG.DRYRUN = true.

• Set CONFIG.CLICKTHRESHOLD = 100.

• Add your proprietary brand terms to CONFIG.PROTECTEDTOKENS.

Click the Preview button at the bottom right of the screen. The preview executes the code in real-time, pulling actual data from your account, but rolls back all database write operations. Check the Logs tab at the bottom. You should see a list of queries that crossed the threshold, their exact click volume, and their conversion value. Validate that no vital search terms appear in that list.

Step 4: Schedule the Execution

Once you have verified the preview log output:

1. Change CONFIG.DRYRUN = false; in line 19.

2. Click Save.

3. In the Scripts main dashboard, locate your script row.

4. Under the Frequency column, set the frequency to Weekly.

5. Select a run time early on a Sunday or Monday morning (e.g., 03:00 AM), ensuring conversions from the prior business week have completely cleared their reporting lag.

For a broader view of weekly account health maintenance, check our Google Ads optimization checklist.

---

Safe Threshold Rules: Avoiding Over-Aggressive Keyword Pruning

A rigid threshold of 100 clicks works well for mass-market accounts, but it can be dangerous if applied blindly without considering your Average Order Value (AOV), typical Customer Acquisition Cost (CAC), and industry conversion economics.

The Relationship Between CPC, Margin, and Click Thresholds

Setting your threshold too low leads to false positives: you exclude search terms that are actually viable but experienced bad variance. Setting it too high means your cut zero conversion queries script permits too much financial bleed before acting.

Consider this comparison across business models:

| Business Model | Typical CPC | Industry Average CVR | Clicks to Reach Break-Even CAC | Recommended Click Threshold | Recommended Lookback | Danger of Setting Threshold Too Low |

| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |

| Low-Ticket E-Commerce ($25-$50 AOV) | $0.60 - $1.20 | 2.5% - 4.0% | 25 - 40 clicks | 60 - 80 clicks | 30 Days | Negligible; products need instant traction to remain profitable. |

| High-Ticket E-Commerce ($1,000+ AOV) | $2.50 - $6.00 | 0.8% - 1.5% | 80 - 150 clicks | 150 - 200 clicks | 90 Days | High; consumers take 20+ days to purchase; premature negatives kill revenue. |

| B2B SaaS / Enterprise Lead Gen | $12.00 - $35.00 | 3.0% - 7.0% | 15 - 30 clicks | 50 - 75 clicks | 60 Days | Extreme; an enterprise contract worth $40k justifies a higher exploratory cost. |

| Local Emergency Services (Plumbing, Locksmith) | $15.00 - $60.00 | 12.0% - 20.0% | 5 - 10 clicks | 25 - 35 clicks | 30 Days | Low; high-intent phone calls occur immediately or not at all. |

For accounts facing high cost environments, cross-reference our analysis on why Google Ads is so expensive to balance exploratory bidding with strict budget protection.

Managing Conversion Attribution Lag

Conversion lag is the span of time between a user clicking your ad and eventually completing a tracked conversion event. In high-consideration sectors, this latency can stretch from 7 to 45 days.

Click Date: Oct 1 ======================= Purchase Date: Oct 24

|--- 23-Day Latency Window ---|

If Script Runs on Oct 15:

Query has 105 clicks, $0 recorded revenue - EXCLUDED PREMATURELY

Outcome: You permanently block a query that was 9 days away from closing a high-value sale.

If your Google Ads attribution reports indicate an average conversion lag of 14 days, you must not run a 14-day lookback window. You should look back 60 or 90 days, and instruct the script to offset the end date by at least 7 to 10 days backwards from the execution date.

---

Advanced Customizations: Google Sheets Logging and Alerting

Production-grade automation should always create an audit trail. If you manage multiple accounts or work in an agency environment, having a script quietly add negative keywords without notifying the PPC lead can make post-mortem analyses difficult.

Adding an Audit Sheet Exporter

You can augment the script to append every excluded term directly into a centralized Google Sheet. This preserves a record of why the term was excluded, its click volume, total spend, and timestamp.

Here is how to add a Google Sheet logger function:

javascript

function logToSheet(spreadsheetUrl, dataRow) {

try {

const sheet = SpreadsheetApp.openByUrl(spreadsheetUrl).getActiveSheet();

// Append: [Timestamp, Search Term, Clicks, Spend, Revenue, Campaign]

sheet.appendRow([

new Date(),

dataRow.term,

dataRow.clicks,

dataRow.spend,

dataRow.value,

dataRow.campaign

]);

} catch (e) {

Logger.log('Google Sheets Logging Error: ' + e.message);

}

}

Within the while (searchResults.hasNext()) loop in the primary script, simply call this function before applying the negative keyword:

javascript

logToSheet('https://docs.google.com/spreadsheets/d/YOURSHEETIDHERE/edit', {

term: searchTerm,

clicks: clicks,

spend: row.metrics.costMicros / 1000000,

value: conversionValue,

campaign: campaignName

});

Integrating Email Notifications

To keep human oversight in the loop without checking logs daily, add an automated email digest using Google Apps Script's native MailApp utility:

javascript

function sendEmailDigest(recipientEmail, excludedList) {

if (excludedList.length === 0) return;

const subject = Google Ads Script: ${excludedList.length} Negative Terms Excluded;

let body = The auto-exclude script ran successfully and added ${excludedList.length} negative keywords:\n\n;

excludedList.forEach(item = {

body += - "${item.term}" (${item.clicks} clicks, $0 revenue in ${item.campaign})\n;

});

MailApp.sendEmail(recipientEmail, subject, body);

}

This simple notification keeps your entire team informed of script actions without requiring manual verification inside the Google Ads platform. If you manage larger portfolios, consulting our negative keywords examples and lists guide will help you pre-populate account-wide blocklists before scripts even need to fire.

---

Edge Cases: Where Simple Scripts Break Down

While Google Ads Scripts are effective for straightforward rule enforcement, they have structural limitations when dealing with dynamic bid landscapes and enterprise-scale accounts.

Script Limitations

|

+------------------------+------------------------+

| |

v v

[Execution Quotas], [Attribution Blindness]

• 30-min hard timeout - Ignores cross-device journeys

• GAQL row fetch limits - Cannot predict multi-touch

• API version deprecations - Blind to seasonal variance

1. The 30-Minute Execution Timeout

Google Ads Scripts enforce a strict 30-minute runtime execution limit. If your account contains 80 campaigns, 1,200 ad groups, and evaluates 400,000 search terms across a 90-day window, a standard searchtermview GAQL loop will time out before processing half of your ad groups. Scaling past this barrier requires writing complex state machines that store execution tokens in UserProperties to resume where the last script run died.

2. Multi-Touch Attribution and Assisted Value

A simple script looks at direct conversion numbers: metrics.conversionsvalue == 0. However, in complex buying cycles, a generic informational search term (e.g., best enterprise crm comparison) might sit at the very top of your sales funnel. A user clicks that term on Day 1, downloads an un-gated whitepaper (no tracked macro-conversion), and returns 18 days later via a brand search query to close a $15,000 deal.

A basic script views that top-funnel term as 104 clicks and $0 revenue—and excludes it. By doing so, you choke off the top of your conversion funnel, driving down overall account volume. Scripts cannot interpret multi-touch attribution models or cross-device journeys without custom BigQuery integrations.

3. API Version Changes and Deprecations

Google continuously iterates on the Google Ads API, occasionally deprecating fields, changing metric schemas, or updating authentication models. A script written today may break without warning 18 months from now when Google forces an infrastructure update, leaving your account unprotected until someone notices the error log.

---

Beyond Static Scripts: Modern AI Search Term Management

Writing and maintaining bespoke JavaScript offers total control, but it carries technical overhead. If you maintain multiple accounts or cannot afford to continually debug GAQL errors, modern autonomous platforms offer an upgrade path.

Static scripts operate purely on backwards-looking, hardcoded logic. If query $X$ hits 100 clicks and zero conversions, it is killed. There is no context, no semantic understanding of query intent, and no nuance regarding whether the conversion drop was driven by landing page downtime, ad copy changes, or seasonal shifts.

This is where intelligent automation platforms diverge from static code. AdTurbo functions as an AI-powered management layer that handles search term pruning continuously. Instead of relying on a single, rigid click threshold that ignores query nuance, AdTurbo's algorithms analyze semantic relevance, user search intent, historical account trends, and conversion probability simultaneously.

Rather than waiting for an arbitrary 100-click threshold—which may cost you several hundred dollars per rogue term—intelligent systems can identify that an emerging query cluster lacks commercial intent after just 15 or 20 clicks, isolating budget waste days before a static script would take action. At $149/mo (with a 7-day trial; credit card required to start), it delivers enterprise-grade guardrails without requiring you to write, test, and debug custom code yourself.

For a deeper look into the manual process this automation replaces, consult our detailed guide on how to use the Google Ads search terms report to cut wasted spend.

---

Related Guides

• How to Use the Google Ads Search Terms Report to Cut Wasted Spend

• How to Find Negative Keywords in Google Ads (Step by Step)

• Negative Keywords: 100+ Examples and Lists for Google Ads

• PPC Audit Checklist: 12 Steps to Fix a Leaking Google Ads Account

---

Frequently Asked Questions

Will this script delete my existing keywords?

No, the script never deletes or pauses your configured keywords. It strictly reads the search queries recorded in your searchtermview and creates exact-match negative keywords ([negative term]) either at the ad group level or within a dedicated shared negative list. Your original keyword bids, settings, and structures remain completely untouched.

Why shouldn't I set the click threshold to 20 or 30 clicks instead of 100?

Setting the click threshold too low introduces significant statistical noise, leading to false positives where potentially profitable queries are permanently blocked before they can convert. For an ad group with an expected 2% conversion rate, missing a conversion across 30 clicks is statistically common and does not prove the query is bad. A 100-click threshold ensures a 95%+ statistical confidence level before making an irreversible exclusion.

How do I undo exclusions made by the script if a mistake happens?

If you configure the script to push negatives to a Shared Negative Keyword List (such as Automated Script Exclusions), you can easily review, uncheck, or delete any mistakenly excluded term directly within the Google Ads Shared Library. If you push negatives directly to ad groups, you will need to open the Negative Keywords tab, sort by date added, and remove the queries manually.

Can this script run across a Google Ads MCC (Manager Account)?

Yes, but the script provided above is built for single ad accounts. To run it across an entire MCC portfolio, you must wrap the core logic inside an AdsManagerApp.accounts().executeInParallel() or select() iterator. Be mindful of Google's strict 30-minute global execution timeout, which frequently requires MCC-level scripts to process sub-accounts in staggered batches.