AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

1.8K members online now
1.8K members online now
Dive into advanced features like Remarketing, Flexible Bid Strategies, AdWords Editor, and AdWords Scripts
Guide Me

Detecting Search terms not containing specific word with Script?

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi everyone,


I saw there is the possibility to use a script to add negative keywords from search term reports based on various KPIs. I was wondering if the same could be done using the term it self when not containing a specific term


In a DSA campaign to add as negative keywords (on campaign or adgroup level) all the search terms non including "nike air".
Thanks for reading!


1 Expert replyverified_user

Re: Detecting Search terms not containing specific word with Script?

Top Contributor
# 2
Top Contributor

Hi @Aless__ it should be possible to do that with a script; you could use the script you mentioned as the framework for retrieving the search terms, then instead of testing them against a KPI, instead test them for the presence of your words.  So, to use your example, if you had a particular search term you were examining, whose text was stored in a variable called theTerm, you might use this test:

if(theTerm.indexOf("nike") == -1 || theTerm.indexOf("air") == -1) {
  // here's where you'd add this search term to the negatives
  Logger.log("Not found");

The .indexOf method searches a (string) variable for the term in brackets and returns it's position in the string, or -1 if not found.






AdWords Top Contributor Google+ Profile | Partner Profile | AdWords Audits