AdsApp.​NegativeKeyword

Represents a Google Ads negative keyword.

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

Methods:

MemberTypeDescription
getAdGroupAdsApp.AdGroupReturns the AdGroup to which the negative keyword belongs.
getBaseAdGroupAdsApp.AdGroupReturns the base AdGroup to which the negative keyword belongs.
getBaseCampaignAdsApp.CampaignReturns the base campaign to which this negative keyword belongs or null if it does not belong to a search or display campaign.
getCampaignAdsApp.CampaignReturns the campaign to which this negative keyword belongs or null if it does not belong to a search or display campaign.
getCampaignTypeStringReturns the campaign type.
getEntityTypeStringReturns the type of this entity as a String, in this case, "NegativeKeyword".
getMatchTypeStringReturns the match type of the negative keyword.
getShoppingAdGroupAdsApp.ShoppingAdGroupReturns the ShoppingAdGroup to which the negative keyword belongs.
getShoppingCampaignAdsApp.ShoppingCampaignReturns the shopping campaign to which this negative keyword belongs or null if it does not belong to a shopping campaign.
getTextStringReturns the text of the negative keyword.
removevoidRemoves 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.AdGroupThe 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.AdGroupThe 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.CampaignThe 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.CampaignThe 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
StringVideo campaign type.

getEntityType()

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

Return values:

TypeDescription
StringType of this entity: "NegativeKeyword".

getMatchType()

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

Return values:

TypeDescription
StringThe 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.ShoppingAdGroupThe 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.ShoppingCampaignThe 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
StringThe text of the negative keyword.

remove()

Removes the negative keyword.

Returns nothing.