Adwords Script: Negative Keyword List Detection

arrow_back Segmenting Your Way to Paid Search Success RV Paid Search: “So… what do you do?” arrow_forward

Let’s get back to the paid search basics… If you’ve been working within paid search for a while, you know that as your paid search accounts balloon in growth, the importance of using a negative keyword list increases in magnitude. Sure, adding negative keywords on the campaign-level works just fine, but as you increase the scale of your account you’re going to want to make edits on the fly… trust us. These lists allow you to add negative keywords to multiple campaigns that all share the same general strategy.

For example, if you have 10 phrase-match keyword focused campaigns and 10 exact-match keyword focused campaigns you will want to create a negative keyword list that contains all your exact-match keywords so you can apply this list to your phrase-match campaigns. (This will make sure your phrase-match campaigns don’t pick up your exact-match keywords.) The beauty of this feature is that you can create a list of your exact-match keywords within minutes and with one checked box you can magically have them all negative out from your phrase match campaigns. This is a lot easier than adding them one by one to each individual campaign, especially if you have 20+ campaigns!


Sometimes it’s hard to remember when creating a new campaign that you should add all the proper negative lists to a specific campaign.   For that specific reason, I put together a simple Adwords script that will audit your account to make sure that you have negative keyword lists on all your campaigns. (For more information on the basics of Adwords Scripts, check out this article)

To run this script, go to the Bulk Operations tab then Scripts.  Click “Create New Script” and paste in the script below.


Name the script, update the first condition based on the naming conventions of your paid search campaigns to specify which group of campaigns (we use #D for desktop campaigns in this example). Now you’re ready to save and run it!


To check the results, go back to your Scripts page and click “Logs.” Then switch the logs tab over from “Changes” to “Logs.”


That’s it!

Hopefully this script will save you some time and money by ensuring you’re completely covered in terms of negative keyword lists, so you don’t pick up unwanted keywords on new campaigns.  If you found this helpful or have ideas for the next version of this script, please let us know!  We plan to add email notification in the next version so you can automate this script to run weekly and notify via email of the results.

The script: 

/***** Negative Keyword List Detection Script v1.0 — RED VENTURES PAID SEARCH*****/
function main() {
var campaignIterator = AdWordsApp.campaigns()

/***** Change the name field below from exact to a different naming convention if necessary *****/

.withCondition(‘Status = ENABLED’).withCondition(‘Name DOES_NOT_CONTAIN “Exact”‘)
while (campaignIterator.hasNext()) {
var campaign =;

var NegativeKeywordListCount = campaign.negativeKeywordLists().get().totalNumEntities();
/***** Change the number of negative keyword lists on the line below *****/
if(NegativeKeywordListCount < 1) {
warn(‘Campaign: “‘+campaign.getName()+'” does not contain a negative keyword list.’);
function warn(msg) {
function info(msg) {


John Kirkpatrick is a paid search associate at Red Ventures – where he leads marketing efforts for the Small Business team within RV Home. Outside of paid search marketing, John interests include start-ups, investing, and Demon Deacon sports. Follow him on Twitter! @kirkjohnpatrick

Want more from our paid search team? Check out our predictions for 2016 here.

Related Posts

Sneak peek: Red Ventures at SMX East
Link-Build Better: A Basic Guide to Outreach Marketing
Sneak peek: Red Ventures at SMX Advanced