How do i write a does not contain function

946 views
Skip to first unread message

ami...@247traffic.com

unread,
Jan 28, 2015, 9:53:07 AM1/28/15
to adwords...@googlegroups.com
I am a novice to writing scripts so this may be an easy one for most. 
Everyhting on the script works.  Except one part where I want to exclude KW's containing a specific word.  I managed to write the condition if the KW contains the word 'review'. 

.withCondition("Text CONTAINS 'review'")

How do i do the opposite, I want all KW's that do not have the word 'review'.
 
var keywordsToRaise = AdWordsApp.keywords()
    .withCondition("Status = ENABLED")
    .withCondition("MatchType = 'Exact'")
    .withCondition("Text CONTAINS_NONE ['review']")
    .forDateRange("YESTERDAY")
    .get();

Thanks

Alexander Wang

unread,
Jan 28, 2015, 2:00:42 PM1/28/15
to adwords...@googlegroups.com
Hi,

The following snippet should do the trick:
var keywordsToRaise = AdWordsApp.keywords()
   
.withCondition("Status = ENABLED")

   
.withCondition("KeywordMatchType = 'Exact'")
   
.withCondition("Text DOES_NOT_CONTAIN ['review']")
   
.get();

You can also use DOES_NOT_CONTAIN_IGNORE_CASE if you want to also filter out keywords containing REVIEW, Review, etc.

FYI, you don't need to specify a date range in this case since you are not filtering on stats (e.g. Clicks, Cost, etc.) at all. Also, I think you want to use "KeywordMatchType" instead of just "MatchType".

Cheers,
Alex
Reply all
Reply to author
Forward
0 new messages