AdsApp.​NegativeKeyword

Represents a Google Ads negative keyword.

Negative keywords can exist either at the ad group level or the campaign level.

Methods:

MemberTypeDescription
getAdGroup() AdsApp.AdGroup Returns the AdGroup to which the negative keyword belongs.
getBaseAdGroup() AdsApp.AdGroup Returns the base AdGroup to which the negative keyword belongs.
getBaseCampaign() AdsApp.Campaign Returns the base campaign to which this negative keyword belongs or null if it does not belong to a search or display campaign.
getCampaign() AdsApp.Campaign Returns the campaign to which this negative keyword belongs or null if it does not belong to a search or display campaign.
getCampaignType() String Returns the campaign type.
getEntityType() String Returns the type of this entity as a String, in this case, "NegativeKeyword".
getMatchType() String Returns the match type of the negative keyword.
getShoppingAdGroup() AdsApp.ShoppingAdGroup Returns the ShoppingAdGroup to which the negative keyword belongs.
getShoppingCampaign() AdsApp.ShoppingCampaign Returns the shopping campaign to which this negative keyword belongs or null if it does not belong to a shopping campaign.
getText() String Returns the text of the negative keyword.
remove() void Removes the negative keyword.

getAdGroup()

Returns the AdGroup to which the negative keyword belongs. This will return null for campaign-level negative keywords and negative keywords which do not belong to a search or display ad group.

Return values:

TypeDescription
AdsApp.AdGroup The AdGroup to which the negative keyword belongs.

getBaseAdGroup()

Returns the base AdGroup to which the negative keyword belongs. This will return null for campaign-level negative keywords and negative keywords which do not belong to a search or display ad group.

Return values:

TypeDescription
AdsApp.AdGroup The base AdGroup to which the negative keyword belongs.

getBaseCampaign()

Returns the base campaign to which this negative keyword belongs or null if it does not belong to a search or display campaign.

Return values:

TypeDescription
AdsApp.Campaign The base campaign to which this negative keyword belongs or null if it does not belong to a search or display campaign.

getCampaign()

Returns the campaign to which this negative keyword belongs or null if it does not belong to a search or display campaign.

Return values:

TypeDescription
AdsApp.Campaign The campaign to which this negative keyword belongs or null if it does not belong to a search or display campaign.

getCampaignType()

Returns the campaign type. Possible return values:

SEARCH_OR_DISPLAY, VIDEO, SHOPPING

Return values:

TypeDescription
String Video campaign type.

getEntityType()

Returns the type of this entity as a String, in this case, "NegativeKeyword".

Return values:

TypeDescription
String Type of this entity: "NegativeKeyword".

getMatchType()

Returns the match type of the negative keyword. Possible values: BROAD, PHRASE, EXACT.

Return values:

TypeDescription
String The match type of the negative keyword.

getShoppingAdGroup()

Returns the ShoppingAdGroup to which the negative keyword belongs. This will return null for campaign-level negative keywords and negative keywords which do not belong to a shopping ad group.

Return values:

TypeDescription
AdsApp.ShoppingAdGroup The ShoppingAdGroup to which the negative keyword belongs.

getShoppingCampaign()

Returns the shopping campaign to which this negative keyword belongs or null if it does not belong to a shopping campaign.

Return values:

TypeDescription
AdsApp.ShoppingCampaign The shopping campaign to which this negative keyword belongs or null if it does not belong to a shopping campaign.

getText()

Returns the text of the negative keyword. The returned value will be formatted as follows, depending on the match type:
  • shoes - broad match
  • "shoes" - phrase match
  • [leather shoes] - exact match

Return values:

TypeDescription
String The text of the negative keyword.

remove()

Removes the negative keyword.

Returns nothing.