AdsApp.NegativeKeywordList
Stay organized with collections
Save and categorize content based on your preferences.
Represents a negative keyword list.
Methods:
addNegativeKeyword(keywordText)
Adds a
SharedNegativeKeyword to a
negative keyword list. Match type for the new shared negative keyword is
specified as follows:
negativeKeywordList.addNegativeKeyword("shoes")
- broad
match.
negativeKeywordList.addNegativeKeyword("\"shoes\"")
-
phrase match.
negativeKeywordList.addNegativeKeyword("[leather
shoes]")
- exact match.
Returns nothing.
Arguments:
Name | Type | Description |
keywordText |
String |
The text of the keyword. |
addNegativeKeywords(keywordTexts)
Adds a list of
SharedNegativeKeyword objects
to a negative keyword list. Match type for the new shared negative keywords
are specified as follows:
negativeKeywordsList.addNegativeKeywords(["planes",
"trains"])
- broad match.
negativeKeywordsList.addNegativeKeywords(["\"planes\"",
"\"trains\""])
- phrase match.
negativeKeywordsList.addNegativeKeywords(["[model planes]",
"[toy trains]")
- exact match.
Returns nothing.
Arguments:
Name | Type | Description |
keywordTexts |
String[] |
An array of keyword texts. |
campaigns()
Returns a selector of all search and display campaigns this negative
keyword list has been applied to.
Return values:
Type | Description |
AdsApp.CampaignSelector |
A selector of all search and display campaigns this negative
keyword list has been applied to. |
getEntityType()
Returns the type of this entity as a
String
, in this case,
"NegativeKeywordList"
.
Return values:
Type | Description |
String |
Type of this entity: "NegativeKeywordList" . |
getId()
Returns the ID of the negative keyword list.
Return values:
Type | Description |
String |
The ID of the negative keyword list. |
getName()
Returns the name of a negative keyword list.
Return values:
Type | Description |
String |
The name of a negative keyword list. |
getResourceName()
Returns the resource name of the negative keyword list.
Return values:
Type | Description |
String |
The resource name of the negative keyword list. |
negativeKeywords()
Returns a selector of the shared negative keywords in a negative keyword
list.
Return values:
setName(name)
Sets the name of a negative keyword list.
Returns nothing.
Arguments:
Name | Type | Description |
name |
String |
The new name of the negative keyword list. |
Returns a selector of all shopping campaigns this negative keyword list has
been applied to.
Return values:
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-25 UTC.
[null,null,["Last updated 2025-08-25 UTC."],[[["\u003cp\u003eRepresents a negative keyword list, allowing you to exclude unwanted search terms from your campaigns.\u003c/p\u003e\n"],["\u003cp\u003eProvides methods to manage negative keywords, such as adding, viewing, and modifying them within the list.\u003c/p\u003e\n"],["\u003cp\u003eEnables application of the negative keyword list to specific campaigns or shopping campaigns for targeted exclusion.\u003c/p\u003e\n"],["\u003cp\u003eOffers functionalities to retrieve information about the negative keyword list, including its ID, name, and associated campaigns.\u003c/p\u003e\n"],["\u003cp\u003eSupports different match types (broad, phrase, exact) for precise control over negative keyword matching.\u003c/p\u003e\n"]]],[],null,["# AdsApp.NegativeKeywordList\n\nRepresents a negative keyword list.\n\n### Methods:\n\n| Member | Type | Description |\n|------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|\n| [addNegativeKeyword(keywordText)](#addNegativeKeyword_keywordText) | `void` | Adds a [SharedNegativeKeyword](/google-ads/scripts/docs/reference/adsapp/adsapp_sharednegativekeyword) to a negative keyword list. |\n| [addNegativeKeywords(keywordTexts)](#addNegativeKeywords_keywordTexts) | `void` | Adds a list of [SharedNegativeKeyword](/google-ads/scripts/docs/reference/adsapp/adsapp_sharednegativekeyword) objects to a negative keyword list. |\n| [campaigns()](#campaigns) | [AdsApp.CampaignSelector](/google-ads/scripts/docs/reference/adsapp/adsapp_campaignselector) | Returns a selector of all search and display campaigns this negative keyword list has been applied to. |\n| [getEntityType()](#getEntityType) | `String` | Returns the type of this entity as a `String`, in this case, `\"NegativeKeywordList\"`. |\n| [getId()](#getId) | `String` | Returns the ID of the negative keyword list. |\n| [getName()](#getName) | `String` | Returns the name of a negative keyword list. |\n| [getResourceName()](#getResourceName) | `String` | Returns the resource name of the negative keyword list. |\n| [negativeKeywords()](#negativeKeywords) | [AdsApp.SharedNegativeKeywordSelector](/google-ads/scripts/docs/reference/adsapp/adsapp_sharednegativekeywordselector) | Returns a selector of the shared negative keywords in a negative keyword list. |\n| [setName(name)](#setName_name) | `void` | Sets the name of a negative keyword list. |\n| [shoppingCampaigns()](#shoppingCampaigns) | [AdsApp.ShoppingCampaignSelector](/google-ads/scripts/docs/reference/adsapp/adsapp_shoppingcampaignselector) | Returns a selector of all shopping campaigns this negative keyword list has been applied to. |\n\n`addNegativeKeyword(keywordText)`\n---------------------------------\n\nAdds a [SharedNegativeKeyword](/google-ads/scripts/docs/reference/adsapp/adsapp_sharednegativekeyword) to a negative keyword list. Match type for the new shared negative keyword is specified as follows:\n\n- `negativeKeywordList.addNegativeKeyword(\"shoes\")` - broad match.\n- `negativeKeywordList.addNegativeKeyword(\"\\\"shoes\\\"\")` - phrase match.\n- `negativeKeywordList.addNegativeKeyword(\"[leather\n shoes]\")` - exact match.\n\nReturns nothing.\n\n### Arguments:\n\n| Name | Type | Description |\n|-------------|----------|--------------------------|\n| keywordText | `String` | The text of the keyword. |\n\n`addNegativeKeywords(keywordTexts)`\n-----------------------------------\n\nAdds a list of [SharedNegativeKeyword](/google-ads/scripts/docs/reference/adsapp/adsapp_sharednegativekeyword) objects to a negative keyword list. Match type for the new shared negative keywords are specified as follows:\n\n- `negativeKeywordsList.addNegativeKeywords([\"planes\",\n \"trains\"])` - broad match.\n- `negativeKeywordsList.addNegativeKeywords([\"\\\"planes\\\"\",\n \"\\\"trains\\\"\"])` - phrase match.\n- `negativeKeywordsList.addNegativeKeywords([\"[model planes]\",\n \"[toy trains]\")` - exact match.\n\nReturns nothing.\n\n### Arguments:\n\n| Name | Type | Description |\n|--------------|------------|----------------------------|\n| keywordTexts | `String[]` | An array of keyword texts. |\n\n`campaigns()`\n-------------\n\nReturns a selector of all search and display campaigns this negative keyword list has been applied to.\n\n### Return values:\n\n| Type | Description |\n|----------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------|\n| [AdsApp.CampaignSelector](/google-ads/scripts/docs/reference/adsapp/adsapp_campaignselector) | A selector of all search and display campaigns this negative keyword list has been applied to. |\n\n`getEntityType()`\n-----------------\n\nReturns the type of this entity as a `String`, in this case, `\"NegativeKeywordList\"`.\n\n### Return values:\n\n| Type | Description |\n|----------|-----------------------------------------------|\n| `String` | Type of this entity: `\"NegativeKeywordList\"`. |\n\n`getId()`\n---------\n\nReturns the ID of the negative keyword list.\n\n### Return values:\n\n| Type | Description |\n|----------|--------------------------------------|\n| `String` | The ID of the negative keyword list. |\n\n`getName()`\n-----------\n\nReturns the name of a negative keyword list.\n\n### Return values:\n\n| Type | Description |\n|----------|--------------------------------------|\n| `String` | The name of a negative keyword list. |\n\n`getResourceName()`\n-------------------\n\nReturns the resource name of the negative keyword list.\n\n### Return values:\n\n| Type | Description |\n|----------|-------------------------------------------------|\n| `String` | The resource name of the negative keyword list. |\n\n`negativeKeywords()`\n--------------------\n\nReturns a selector of the shared negative keywords in a negative keyword list.\n\n### Return values:\n\n| Type | Description |\n|------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------|\n| [AdsApp.SharedNegativeKeywordSelector](/google-ads/scripts/docs/reference/adsapp/adsapp_sharednegativekeywordselector) | A selector of the shared negative keywords in a negative keyword list. |\n\n`setName(name)`\n---------------\n\nSets the name of a negative keyword list.\n\nReturns nothing.\n\n### Arguments:\n\n| Name | Type | Description |\n|------|----------|--------------------------------------------|\n| name | `String` | The new name of the negative keyword list. |\n\n`shoppingCampaigns()`\n---------------------\n\nReturns a selector of all shopping campaigns this negative keyword list has been applied to.\n\n### Return values:\n\n| Type | Description |\n|--------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|\n| [AdsApp.ShoppingCampaignSelector](/google-ads/scripts/docs/reference/adsapp/adsapp_shoppingcampaignselector) | A selector of all shopping campaigns this negative keyword list has been applied to. |"]]