Enhanced version of Google Ads Script: Negative Keywords Conflicts

One of my favorite use cases for scripts is managing negative keywords. I use scripts to:

  • suggest negative keywords candidates
  • allow for easy management of negatives via Google Sheets
  • do n-gram analyses to discover potential negative candidates
  • keep exact match keywords exact (super handy for brand campaigns to prevent non-brand from matching your brand keyword)
  • auto-negate converting search terms in HIGH prio Shopping campaigns, so that the queries get funneled into higher bid MED prio campaigns
  • automatically add positive keywords to a negative keyword list that is attached to my DSA campaigns to prevent cannibalization
  • …and a ton of other things.

Occasionally, I or my team members make the unfortunate mistake of accidentally adding a negative keyword that blocks one or more positive keywords. Not good. So, I use another script to alert me when that happens: the Negative Keyword Conflicts script.

The original script is developed by Google, but it has a major drawback: it also looks at keywords in campaigns that have ended (i.e., ended experiment campaigns). This results in a lot of false alerts, making you want to ignore them altogether.

To fix this issue, I decide to change the script to only look at campaigns that are still serving. This fix was easy. The only thing I need to add was the condition to only look at campaigns with serving_status = ‘SERVING’.

In the code, that means one extra condition in the GAQL query (extra condition emphasized):

WHERE campaign.status = "ENABLED" AND campaign.serving_status = "SERVING" AND ad_group.status = "ENABLED" +

Here’s the enhanced version of the Google Ads Script for Negative Keywords Conflicts:

https://nilsrooijmans.com/negative-keyword-conflicts-alert-script-update/

What the script does:

It sends out an email alert if an account has positive keywords which are blocked by negative keywords. The script saves all such conflicts to a spreadsheet and sends out the email alert.

Why this matters:

Negative keywords are intended to prevent ads from showing on irrelevant search queries, but they may inadvertently block normal keywords from matching relevant search queries, making your campaigns less effective.

Happy scripting!

-Nils

Author: Nils Rooijmans

Google Ads Performance Architect with a passion for PPC Automation & AI, in particular via Google Ads Scripts.