Feed-Driven Negative Keyword Automation for Discontinued SKUs

Learn how to build a feed-driven negative keyword automation to auto-block out-of-stock and discontinued SKU variations across Google Ads campaigns.

By AdTurbo Team · 2026-09-04

Managing e-commerce ad spend across thousands of catalog items presents a continuous challenge: products sell out, manufacturers retire specific colorways or size variants, and seasonal product lines reach end-of-life. While Google Merchant Center automatically pauses Shopping ads for items marked outofstock, standard Search and Performance Max campaigns do not inherit those inventory states.

When a specific SKU variation is discontinued, broad match and phrase match Search queries continue to trigger your ads. Shoppers click through expecting an item that no longer exists, landing on an out-of-stock product detail page or a generic category page. The result is a direct hit to your conversion rate, wasted ad budget, and lower Quality Scores.

Setting up a feed driven negative keyword automation bridges the gap between your real-time product feed and your Google Ads search term exclusions. In this technical guide, we will break down how to extract out-of-stock and discontinued product data from your feed, parse variation strings into safe negative keywords, and deploy an automated script pipeline directly into your Google Ads account.

---

The Hidden Cost of Discontinued SKU Traffic in Google Ads

When an e-commerce store discontinues a product variation—such as a specific size, technical model number, or colorway—the inventory system updates the product status, but search demand does not vanish overnight.

The Search and Shopping Disconnect

Google Shopping and Performance Max product listings rely on the availability attribute in Google Merchant Center. When a product’s status changes to outofstock, Google stops serving Shopping product ads for that specific item ID.

However, your Search campaigns, dynamic search ad (DSA) groups, and Performance Max search theme expansions do not read product-level inventory flags in real time. If you run Search campaigns targeting brand or product queries (e.g., "Acme Carbon Trail Running Shoes Size 12 Men's"), those ads continue running regardless of whether Size 12 is in stock.

The Parent-Child Variant Dilemma

E-commerce catalogs often organize items under a parent product with multiple child SKUs. When three out of ten child SKUs are permanently discontinued, standard inventory management creates subtle budget leaks:

1. High-Intent Bounce Rates: Shoppers searching for specific model numbers or sizes land on the parent page, realize their option is gone, and bounce immediately.

2. Misallocated Bidding Signals: Automated bidding algorithms (like Target ROAS) may see conversions on the parent page from other variants and continue bidding aggressively on queries for the discontinued variant.

3. Quality Score Decay: High bounce rates and declining post-click conversion rates on specific landing pages depress expected CTR and landing page experience metrics.

To plug these leaks without spending hours manually parsing through your search terms report, you need an automated process to identify dead SKUs and push them directly into shared negative keyword lists.

---

How Negative Keyword Match Types Behave for E-Commerce SKUs

Before writing an automation script, you must understand how Google Ads processes negative keyword match types when handling product titles, alphanumeric model numbers, and variant strings.

Feed Discontinued Status ── Script Extraction ── String Normalization ── Match Type Formatting ── Shared Negative List

Negative Broad Match

Negative broad match blocks impressions only if the user query contains every single word in your negative keyword string, regardless of order.

• Negative Keyword: acme carbon trail size 12

• Blocked Query: "where to buy acme size 12 carbon trail shoes"

• Allowed Query: "acme carbon trail shoes" (Size 12 omitted, so ad serves)

• Risk: If your negative broad keyword is too short (e.g., size 12), it will block searches for all size 12 shoes across your entire catalog, not just the discontinued model.

Negative Phrase Match

Negative phrase match blocks queries containing the exact phrase in the exact order, even if additional words appear before or after.

• Negative Keyword: "acme carbon size 12"

• Blocked Query: "buy acme carbon size 12 online"

• Allowed Query: "acme size 12 carbon" (Word order differs, so ad serves)

• Best Use Case: Model names paired with a specific attribute, such as "soundpulse mini red".

Negative Exact Match

Negative exact match blocks queries that match your exact negative keyword string without any extra terms.

• Negative Keyword: [acme sku-98214-blk]

• Blocked Query: "acme sku-98214-blk"

• Allowed Query: "cheap acme sku-98214-blk discount"

• Best Use Case: Highly specific, standalone SKU queries and part numbers where you only want to block exact lookup searches.

For most feed-driven automations targeting discontinued variations, combining negative exact match for standalone SKU identifiers and negative phrase match for specific [Parent Title] + [Variant Attribute] combinations yields the lowest false-positive rate. For more match type strategies, review our guide on how to find negative keywords.

---

Architecture of a Feed-Driven Negative Keyword Automation Pipeline

Building an end-to-end automation requires three core components: an accessible product feed source, a parsing engine (such as a Google Ads Script or cloud function), and designated Shared Negative Lists inside Google Ads.

┌────────────────────────────────────────┐

│ 1. Product Feed Source │

│ - Merchant Center Export (TSV / XML) │

│ - Custom CSV via Cloud Storage / URL │

│ - Shopify / BigCommerce Webhook │

└──────────────────┬─────────────────────┘

│

▼

┌────────────────────────────────────────┐

│ 2. Processing Engine (Ads Script) │

│ - Filter: availability = 'out of stock'│

│ - Filter: customlabel0 = 'archive' │

│ - Normalize text, strip special chars │

│ - Apply match type syntax: [], "" │

└──────────────────┬─────────────────────┘

│

▼

┌────────────────────────────────────────┐

│ 3. Google Ads Account Lists │

│ - Account-Level Negative List │

│ - Shared Negative List (Search) │

│ - Campaign-Level Exclusions (PMax) │

└────────────────────────────────────────┘

1. The Data Source

Your feed needs to clearly separate temporary stockouts from permanent discontinuations. You can manage this using:

• Merchant Center Status: availability set to outofstock.

• Custom Labels: Setting customlabel0 to discontinued or endoflife in your product feed. This prevents your script from accidentally negating seasonal items that will be restocked next week.

2. The Extraction Logic

The script fetches the feed file via HTTP or Google Drive, filters for items tagged as discontinued, and isolates identifying keywords (SKU codes, model names, and variant parameters).

3. The Negative List Handler

Rather than adding keywords directly to individual ad groups, the script pushes them to a Shared Negative Keyword List applied across all relevant Search and Shopping campaigns. This prevents hitting campaign-level keyword limits and simplifies account audits.

---

Step-by-Step: Building a Discontinued SKU Negative Keyword Script

Here is a complete, production-ready Google Ads Script that reads a CSV/TSV feed export URL, parses discontinued SKUs, and updates a shared negative list automatically.

Step 1: Set Up Your Feed Export

Generate a live CSV or TSV URL from your e-commerce platform (Shopify, WooCommerce, BigCommerce) or Google Merchant Center that contains at minimum the following columns:

• id (The unique SKU)

• title (Product title)

• availability (e.g., out of stock or in stock)

• customlabel0 (e.g., discontinued)

Step 2: Implement the Google Ads Script

Navigate to Tools and Settings Bulk Actions Scripts in your Google Ads account, create a new script, and paste the code below:

javascript

/

• Feed-Driven Negative Keyword Automation for Discontinued SKUs

• AdTurbo Automation Snippet

/

const CONFIG = {

feedUrl: 'https://example.com/feeds/discontinued-products.csv',

sharedListName: 'Auto Discontinued SKUs',

delimiter: ',', // Use '\t' for TSV

targetHeaderSku: 'id',

targetHeaderTitle: 'title',

targetHeaderStatus: 'customlabel0',

discontinuedFlag: 'discontinued',

maxNegativesPerRun: 500

};

function main() {

Logger.log('Starting Feed-Driven Negative Keyword Automation...');

const negativeList = getOrCreateSharedList(CONFIG.sharedListName);

const existingNegatives = getExistingNegatives(negativeList);

const discontinuedItems = fetchDiscontinuedItems();

Logger.log(Found ${discontinuedItems.length} discontinued items in feed.);

let addedCount = 0;

for (const item of discontinuedItems) {

if (addedCount = CONFIG.maxNegativesPerRun) {

Logger.log('Reached max execution batch limit.');

break;

}

// Format 1: Exact match on standalone SKU

const skuNegative = [${item.sku.trim()}];

if (item.sku && !existingNegatives.has(skuNegative.toLowerCase())) {

negativeList.addNegativeKeyword(skuNegative);

existingNegatives.add(skuNegative.toLowerCase());

addedCount++;

}

// Format 2: Phrase match on specific product title variation

if (item.title && item.title.length < 80) {

const cleanTitle = cleanKeywordText(item.title);

const phraseNegative = "${cleanTitle}";

if (!existingNegatives.has(phraseNegative.toLowerCase())) {

negativeList.addNegativeKeyword(phraseNegative);

existingNegatives.add(phraseNegative.toLowerCase());

addedCount++;

}

}

}

Logger.log(Successfully added ${addedCount} new negative keywords.);

}

function fetchDiscontinuedItems() {

const response = UrlFetchApp.fetch(CONFIG.feedUrl, {

muteHttpExceptions: true,

headers: { 'User-Agent': 'GoogleAdsScript-FeedNegativeAutomation' }

});

if (response.getResponseCode() !== 200) {

throw new Error(Failed to fetch feed: HTTP ${response.getResponseCode()});

}

const csvData = Utilities.parseCsv(response.getContentText(), CONFIG.delimiter);

const headers = csvData[0].map(h = h.trim().toLowerCase());

const skuIdx = headers.indexOf(CONFIG.targetHeaderSku.toLowerCase());

const titleIdx = headers.indexOf(CONFIG.targetHeaderTitle.toLowerCase());

const statusIdx = headers.indexOf(CONFIG.targetHeaderStatus.toLowerCase());

if (skuIdx === -1 || statusIdx === -1) {

throw new Error('Required headers not found in feed CSV.');

}

const items = [];

for (let i = 1; i < csvData.length; i++) {

const row = csvData[i];

const status = row[statusIdx] ? row[statusIdx].trim() : '';

if (status.toLowerCase() === CONFIG.discontinuedFlag.toLowerCase()) {

items.push({

sku: row[skuIdx] ? row[skuIdx].trim() : '',

title: titleIdx !== -1 && row[titleIdx] ? row[titleIdx].trim() : ''

});

}

}

return items;

}

function getOrCreateSharedList(listName) {

const listIterator = AdsApp.negativeKeywordLists()

.withCondition(Name = '${listName}')

.get();

if (listIterator.hasNext()) {

return listIterator.next();

}

Logger.log(Shared list '${listName}' not found. Creating a new one.);

const operation = AdsApp.newNegativeKeywordListBuilder()

.withName(listName)

.build();

return operation.getResult();

}

function getExistingNegatives(sharedList) {

const existing = new Set();

const negIterator = sharedList.negativeKeywords().get();

while (negIterator.hasNext()) {

existing.add(negIterator.next().getText().toLowerCase());

}

return existing;

}

function cleanKeywordText(text) {

return text

.replace(/[+?^$()|[\]{}\\]/g, '')

.replace(/\s+/g, ' ')

.trim();

}

Step 3: Schedule the Script

Set the script to run Daily or Every 12 Hours. Whenever your warehouse or merchandising team marks a SKU with the discontinued flag in your feed, the script parses the update on its next run and appends the exact SKU and formatted title to your shared negative list.

If you prefer not to maintain custom scripts and want enterprise-grade optimization built into your campaigns, platforms like AdTurbo handle negative keyword mining, feed hygiene, and real-time bid adjustments automatically.

---

Managing Performance Max and Account-Level Negative Lists

Performance Max campaigns present a unique challenge for automated negatives. Standard Shared Negative Keyword Lists attached to Search campaigns do not automatically apply to Performance Max campaigns unless configured via account-level exclusions or Google representative whitelisting.

┌─────────────────────────────────────────────────────────────┐

│ Google Ads Account Negatives │

├──────────────────────────────┬──────────────────────────────┤

│ Account-Level Negative Lists │ Shared Campaign Lists │

│ • Applies to Search │ • Attached per Search Camp │

│ • Applies to PMax Search │ • Attached to Standard Shop │

│ • Limit: 1 list / 1,000 keys │ • Limit: 20 lists / 5,000 ea │

└──────────────────────────────┴──────────────────────────────┘

Account-Level Negative Keyword Lists

In recent Google Ads updates, you can create a single account-level negative keyword list that applies across all Search and Performance Max campaigns simultaneously.

• Limit: 1 account-level list per account containing up to 1,000 negative keywords.

• Use Case for Discontinued SKUs: Ideal for top-tier discontinued parent products that generate heavy cross-network waste. Because of the 1,000-keyword ceiling, reserve this list for high-traffic discontinued identifiers.

Campaign-Level Negative Lists for Search & Shopping

For catalogs with tens of thousands of discontinued SKUs, standard Shared Negative Lists remain the primary vehicle:

• You can link a shared negative list to all standard Search and Shopping campaigns.

• Each shared list supports up to 5,000 negative keywords, and an account can house up to 20 shared lists (providing room for 100,000 total exclusions).

PMax Brand Exclusions

If an entire discontinued product line operated under a sub-brand name (e.g., "Acme SubBrand V1"), you can use Performance Max Brand Lists to exclude that entire brand identity from PMax campaigns without relying on keyword lists.

For more structured examples of account negative setup, see our guide on negative keyword examples and lists.

---

Error Handling, API Rate Limits, and Edge Cases

Automating keyword additions directly from an external data feed introduces several edge cases that can disrupt campaign delivery if not handled properly.

1. The Re-Stocking / Reactivation Problem

What happens when a manufacturer re-releases a discontinued product or an inventory audit discovers 500 units in a secondary warehouse?

• If your script only adds negatives and never removes them, those reactivated items will remain blocked from Search ad traffic.

• Solution: Add a cleanup pass to your script that checks your shared negative list against the active instock items in your feed. If an active product's SKU matches an existing negative keyword, the script executes negativeKeyword.remove().

2. Special Characters and String Sanitization

SKU codes often contain hyphens, forward slashes, periods, and colons (e.g., SKU/9821-BLK10).

• Google Ads negative keywords do not support characters such as , !, @, %, &, , or parentheses ().

• Pushing unsanitized strings will trigger API validation errors and halt the script execution. Ensure your sanitization function strips invalid symbols before formatting match types.

3. Over-Negating Parent Terms (The Substring Trap)

Consider an item named "Ultra Hydrating Cream 50ml - Formula 2022".

• If your script strips the title and creates a negative phrase keyword for "Ultra Hydrating Cream", it will block traffic for your newly launched "Ultra Hydrating Cream 50ml - Formula 2026".

• Guardrail: Never create broad or short phrase negatives from product titles automatically unless they contain distinctive variant attributes (like specific model codes or obsolete years).

Safe vs. Dangerous Script Exclusions:

❌ DANGEROUS: "Men's Running Shoes" (Blocks entire category)

❌ DANGEROUS: "Pro Laptop 15 Inch" (Blocks current generation)

✅ SAFE: [sku-88392-xl]

✅ SAFE: "pro laptop 15 inch 2021 model"

✅ SAFE: [nike pegasus 38 black size 13]

---

Manual vs. Scripted vs. AI-Driven Feed Negatives

Depending on the size of your catalog and the frequency of SKU turnover, different management methods offer varying trade-offs in setup time, scalability, and error resilience.

| Feature / Metric | Manual Search Term Review | Google Ads Script (Feed-Driven) | AI-Driven PPC Automation Platform |

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

| Catalog Scalability | Low (< 500 SKUs) | High (Up to 50,000 SKUs) | Unlimited Enterprise Scale |

| Update Latency | Days to Weeks | Every 12–24 Hours | Real-Time / Hourly |

| Parent-Child Safety Checks | Manual Human Judgment | Rule-Based (Regex / Exact Match) | Context-Aware Semantic Models |

| PMax Campaign Support | Manual Campaign Negatives | Account-Level Shared Lists | Direct API Integration (PMax & Search) |

| Re-Stock Auto-Unblocking| Manual Removal | Requires Custom Script Logic | Automated Inventory Synchronization |

| Setup Complexity | None (Built into UI) | Moderate (JavaScript / Feeds) | Low (Pre-Built Connectors) |

| Risk of False Positives | Low | Moderate (Script Logic Dependent) | Ultra-Low (Continuous Monitoring) |

For smaller stores, manual reviews using a comprehensive PPC audit checklist may suffice. However, multi-brand retailers and high-SKU merchants typically outgrow manual reviews within their first few months of scaling.

---

Maintenance Workflows and Audit Routines

Even a fully automated negative keyword script requires periodic oversight to prevent list bloat and ensure that active revenue-generating queries remain unblocked.

Weekly Script Execution Logs ── Audit Negative List Caps ── Cross-Check Active Impression Spikes

1. Weekly Execution Log Audits

Check the Execution History tab in Google Ads Scripts weekly to verify:

• The feed URL returned HTTP 200 without timeouts.

• The script did not hit Google's 30-minute script execution limit.

• Added keyword counts match expected inventory shifts from your merchandising reports.

2. Monitoring Zero-Impression Alerts on Core Parent Products

If impressions on a core parent product campaign suddenly drop to zero after a script run, immediately cross-reference your shared negative list. A malformed title extraction rule may have added a broad parent term into the exclusion list.

3. Pruning Stale Negative Keywords

Google Ads accounts have a hard ceiling on total negative keywords across lists. Furthermore, search volume for discontinued product SKUs naturally degrades over 12 to 18 months.

• Implement an annual cleanup policy to remove negative keywords for SKUs that have been out of market for more than two years.

• This frees up capacity in your shared lists for newly discontinued inventory lines.

If you want to streamline this entire workflow without writing custom JavaScript or maintaining feed parsers, AdTurbo's PPC management software continuously monitors your inventory feeds, detects out-of-stock variations, and updates your negative keyword structures in real time.

---

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)

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

---

Frequently Asked Questions

Will adding discontinued SKUs as negative keywords hurt my Google Shopping campaigns?

No, because Google Shopping ads already rely on Merchant Center product availability data to stop serving ads for out-of-stock SKUs. Adding discontinued SKUs to shared negative lists primarily protects your Search, Dynamic Search Ads, and Performance Max search queries from bidding on obsolete product terms.

How often should my feed-driven negative keyword script run?

Running the script once every 12 to 24 hours is optimal for most e-commerce businesses. This frequency aligns with standard product feed export schedules without consuming excessive Google Ads API quota or script execution limits.

What happens if an out-of-stock SKU comes back into stock later?

If your script only adds negative keywords without an unblocking mechanism, the restocked product will remain blocked from Search ad traffic. To prevent this, your script must include logic to cross-reference active feed items and remove corresponding negative keywords when stock is replenished.

Should I use exact match or phrase match for discontinued SKU negatives?

Use negative exact match ([SKU]) for standalone alphanumeric part numbers and product codes to avoid accidentally blocking related queries. Use negative phrase match ("Product Name + Variant") only when targeting specific attribute combinations like obsolete colors, sizes, or release years.