AdsApp.​AdGroup

Represents a Google Ads ad group.

Methods:

MemberTypeDescription
adParamsAdsApp.AdParamSelectorCreates a selector of all ad params in the ad group.
addCalloutAdsApp.CalloutOperationAdds a callout to this ad group.
addMobileAppAdsApp.MobileAppOperationAdds a mobile app to this ad group.
addPhoneNumberAdsApp.PhoneNumberOperationAdds a phone number to this ad group.
addPriceAdsApp.PriceOperationAdds a price extension to this ad group.
addSitelinkAdsApp.SitelinkOperationAdds a sitelink to this ad group.
addSnippetAdsApp.SnippetOperationAdds a snippet to this ad group.
adsAdsApp.AdSelectorReturns the selector of all ads in the ad group.
applyLabelvoidApplies a label to the ad group.
biddingAdsApp.AdGroupBiddingProvides access to this ad group's bidding fields.
clearMobileBidModifiervoidClears the mobile bid modifier for this ad group.
createNegativeKeywordvoidCreates a new negative keyword with the specified text.
devicesAdsApp.AdGroupDevicesReturns an AdGroupDevices instance associated with the ad group.
displayAdsApp.AdGroupDisplayProvides access to this ad group's display criteria: Audience, ExcludedAudience, DisplayKeyword, ExcludedDisplayKeyword, Placement, ExcludedPlacement, Topic, and ExcludedTopic.
enablevoidEnables the ad group.
extensionsAdsApp.AdGroupExtensionsProvides access to this ad group's extensions: AdGroupCallout, AdGroupMobileApp, AdGroupPhoneNumber, AdGroupSitelink, and AdGroupSnippet.
getBaseAdGroupAdsApp.AdGroupReturns the base ad group to which this ad group belongs.
getBaseCampaignAdsApp.CampaignReturns the base campaign to which this ad group belongs.
getCampaignAdsApp.CampaignReturns the campaign to which this ad group belongs or null if it does not belong to a search or display campaign.
getEntityTypeStringReturns the type of this entity as a String, in this case, "AdGroup".
getIdStringReturns the ID of the ad group.
getMobileBidModifierdoubleReturns the mobile bid modifier for this ad group.
getNameStringReturns the name of the ad group.
getResourceNameStringReturns the resource name of the ad group.
getStatsForAdsApp.StatsReturns stats for the specified date range.
getStatsForAdsApp.StatsReturns stats for the specified custom date range.
isEnabledbooleanReturns true if the ad group is enabled.
isPausedbooleanReturns true if the ad group is paused.
isRemovedbooleanReturns true if the ad group is removed.
keywordsAdsApp.KeywordSelectorReturns the selector of all keywords in the ad group.
labelsAdsApp.LabelSelectorCreates a selector of all labels applied to the ad group.
negativeKeywordsAdsApp.NegativeKeywordSelectorReturns a selector of all negative keywords in the ad group.
newAdAdsApp.AdBuilderSpaceReturns a new ad builder space associated with this ad group.
newKeywordBuilderAdsApp.KeywordBuilderReturns a new keyword builder associated with this ad group.
pausevoidPauses the ad group.
recommendationsAdsApp.RecommendationSelectorReturns the selector of all recommendations for this ad group.
removeCalloutvoidRemoves a callout extension from this ad group.
removeLabelvoidRemoves a label from the ad group.
removeMobileAppvoidRemoves a mobile app extension from this ad group.
removePhoneNumbervoidRemoves a phone number extension from this ad group.
removePricevoidRemoves a price extension from this ad group.
removeSitelinkvoidRemoves a sitelink extension from this ad group.
removeSnippetvoidRemoves a snippet extension from this ad group.
setMobileBidModifiervoidSets the mobile bid modifier for this ad group to the specified value.
setNamevoidSets the name of the ad group.
targetingAdsApp.AdGroupTargetingProvides access to ad group-level targeting criteria: audiences.
urlsAdsApp.AdGroupUrlsProvides access to this ad group's URL fields.

adParams()

Creates a selector of all ad params in the ad group.

Return values:

TypeDescription
AdsApp.AdParamSelectorSelector of all ad params in the ad group.

addCallout(calloutExtension)

Adds a callout to this ad group. See also Extensions.newCalloutBuilder()

Arguments:

NameTypeDescription
calloutExtensionAdsApp.CalloutThe callout to add to this ad group.

Return values:

TypeDescription
AdsApp.CalloutOperationThe associated callout operation.

addMobileApp(mobileAppExtension)

Adds a mobile app to this ad group. See also Extensions.newMobileAppBuilder()

Arguments:

NameTypeDescription
mobileAppExtensionAdsApp.MobileAppThe mobile app to add to this ad group.

Return values:

TypeDescription
AdsApp.MobileAppOperationThe associated mobile app operation.

addPhoneNumber(phoneNumberExtension)

Adds a phone number to this ad group. See also Extensions.newPhoneNumberBuilder()

Arguments:

NameTypeDescription
phoneNumberExtensionAdsApp.PhoneNumberThe phone number to add to this ad group.

Return values:

TypeDescription
AdsApp.PhoneNumberOperationThe associated phone number operation.

addPrice(priceExtension)

Adds a price extension to this ad group. See also Extensions.newPriceBuilder().

Arguments:

NameTypeDescription
priceExtensionAdsApp.PriceThe price to add to this ad group.

Return values:

TypeDescription
AdsApp.PriceOperationThe associated price operation.
Adds a sitelink to this ad group. See also Extensions.newSitelinkBuilder()

Arguments:

NameTypeDescription
sitelinkExtensionAdsApp.SitelinkThe sitelink to add to this ad group.

Return values:

TypeDescription
AdsApp.SitelinkOperationThe associated sitelink operation.

addSnippet(snippetExtension)

Adds a snippet to this ad group. See also Extensions.newSnippetBuilder()

Arguments:

NameTypeDescription
snippetExtensionAdsApp.SnippetThe snippet to add to this ad group.

Return values:

TypeDescription
AdsApp.SnippetOperationThe associated snippet operation.

ads()

Returns the selector of all ads in the ad group.

Return values:

TypeDescription
AdsApp.AdSelectorThe selector of all ads in the ad group.

applyLabel(name)

Applies a label to the ad group. name of the label is case-sensitive. Operation will fail if the label with the specified name does not already exist in the account.

Note that the ad group cannot have more than 50 labels.

Returns nothing.

Arguments:

NameTypeDescription
nameStringName of the label to apply.

bidding()

Provides access to this ad group's bidding fields.

Return values:

TypeDescription
AdsApp.AdGroupBiddingAccess to this ad group's bidding fields.

clearMobileBidModifier()

Clears the mobile bid modifier for this ad group. By clearing this value, the ad group will use its campaign's mobile bid modifier (if one is set).

For more information about bid modifiers, please see the Google Ads Help Center article.

Returns nothing.

createNegativeKeyword(keywordText)

Creates a new negative keyword with the specified text.

Match type for the new negative keyword is specified as follows:

  • createNegativeKeyword("shoes") - broad match.
  • createNegativeKeyword("\"shoes\"") - phrase match.
  • createNegativeKeyword("[leather shoes]") - exact match.

Returns nothing.

Arguments:

NameTypeDescription
keywordTextStringThe text of the new negative keyword.

devices()

Returns an AdGroupDevices instance associated with the ad group.

Return values:

TypeDescription
AdsApp.AdGroupDevicesAn AdGroupDevices instance associated with the ad group.

display()

Provides access to this ad group's display criteria: Audience, ExcludedAudience, DisplayKeyword, ExcludedDisplayKeyword, Placement, ExcludedPlacement, Topic, and ExcludedTopic.

Return values:

TypeDescription
AdsApp.AdGroupDisplayAccess to this ad group's display criteria.

enable()

Enables the ad group.

Returns nothing.

extensions()

Provides access to this ad group's extensions: AdGroupCallout, AdGroupMobileApp, AdGroupPhoneNumber, AdGroupSitelink, and AdGroupSnippet.

Return values:

TypeDescription
AdsApp.AdGroupExtensionsAccess to this ad group's extensions.

getBaseAdGroup()

Returns the base ad group to which this ad group belongs.

Return values:

TypeDescription
AdsApp.AdGroupThe base ad group to which this ad group belongs.

getBaseCampaign()

Returns the base campaign to which this ad group belongs.

Return values:

TypeDescription
AdsApp.CampaignThe base campaign to which this ad group belongs.

getCampaign()

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

Return values:

TypeDescription
AdsApp.CampaignThe campaign to which this ad group belongs or null if it does not belong to a search or display campaign.

getEntityType()

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

Return values:

TypeDescription
StringType of this entity: "AdGroup".

getId()

Returns the ID of the ad group.

Return values:

TypeDescription
StringThe ID of the ad group.

getMobileBidModifier()

Returns the mobile bid modifier for this ad group.

The bid modifier is a multiplier applied to the ad group's bids on mobile devices. So, for instance, a bid modifier of 1.1 increases the bid to 110% of its original value, and changes a bid of $5.00 to $5.50.

Note that when you set a mobile bid modifier at both campaign- and ad group-level in a single campaign, the ad group mobile bid modifier will be used when determining your bid UNLESS the campaign mobile bid modifier is set to -1 (i.e. -100%) which will opt the entire campaign out of mobile regardless of any ad group mobile bid modifiers that may have been set.

For more information about bid modifiers, please see the Google Ads Help Center article.

Return values:

TypeDescription
doubleThe mobile bid modifier.

getName()

Returns the name of the ad group.

Return values:

TypeDescription
StringName of the ad group.

getResourceName()

Returns the resource name of the ad group.

Return values:

TypeDescription
StringThe resource name of the ad group.

getStatsFor(dateRange)

Returns stats for the specified date range. Supported values:

TODAY, YESTERDAY, LAST_7_DAYS, THIS_WEEK_SUN_TODAY, LAST_WEEK, LAST_14_DAYS, LAST_30_DAYS, LAST_BUSINESS_WEEK, LAST_WEEK_SUN_SAT, THIS_MONTH, LAST_MONTH, ALL_TIME.

Example:

var stats = adGroup.getStatsFor("THIS_MONTH");

Arguments:

NameTypeDescription
dateRangeStringDate range for which the stats are requested.

Return values:

TypeDescription
AdsApp.StatsThe stats for the specified date range.

getStatsFor(dateFrom, dateTo)

Returns stats for the specified custom date range. Both parameters can be either an object containing year, month, and day fields, or an 8-digit string in YYYYMMDD form. For instance, March 24th, 2013 is represented as either {year: 2013, month: 3, day: 24} or "20130324". The date range is inclusive on both ends, so forDateRange("20130324", "20130324") defines a range of a single day.

Arguments:

NameTypeDescription
dateFromObjectStart date of the date range. Must be either a string in YYYYMMDD form, or an object with year, month and day properties.
dateToObjectEnd date of the date range. Must be either a string in YYYYMMDD form, or an object with year, month and day properties.

Return values:

TypeDescription
AdsApp.StatsThe stats for the specified date range.

isEnabled()

Returns true if the ad group is enabled.

Return values:

TypeDescription
booleantrue if the ad group is enabled.

isPaused()

Returns true if the ad group is paused.

Return values:

TypeDescription
booleantrue if the ad group is paused.

isRemoved()

Returns true if the ad group is removed.

Return values:

TypeDescription
booleantrue if the ad group is removed.

keywords()

Returns the selector of all keywords in the ad group.

Return values:

TypeDescription
AdsApp.KeywordSelectorThe selector of all keywords in the ad group.

labels()

Creates a selector of all labels applied to the ad group.

Return values:

TypeDescription
AdsApp.LabelSelectorSelector of all labels applied to the ad group.

negativeKeywords()

Returns a selector of all negative keywords in the ad group.

Return values:

TypeDescription
AdsApp.NegativeKeywordSelectorThe selector of all negative keywords in the ad group.

newAd()

Returns a new ad builder space associated with this ad group.

Return values:

TypeDescription
AdsApp.AdBuilderSpaceA new ad builder space associated with this ad group.

newKeywordBuilder()

Returns a new keyword builder associated with this ad group.

Return values:

TypeDescription
AdsApp.KeywordBuilderA new keyword builder associated with this ad group.

pause()

Pauses the ad group.

Returns nothing.

recommendations()

Returns the selector of all recommendations for this ad group.

Return values:

TypeDescription
AdsApp.RecommendationSelectorThe selector of all recommendations for this ad group.

removeCallout(calloutExtension)

Removes a callout extension from this ad group.

Returns nothing.

Arguments:

NameTypeDescription
calloutExtensionAdsApp.CalloutThe callout to remove from this ad group.

removeLabel(name)

Removes a label from the ad group. name of the label is case-sensitive. Operation will fail if the label with the specified name does not already exist in the account.

Returns nothing.

Arguments:

NameTypeDescription
nameStringName of the label.

removeMobileApp(mobileAppExtension)

Removes a mobile app extension from this ad group.

Returns nothing.

Arguments:

NameTypeDescription
mobileAppExtensionAdsApp.MobileAppThe mobile app to remove from this ad group.

removePhoneNumber(phoneNumberExtension)

Removes a phone number extension from this ad group.

Returns nothing.

Arguments:

NameTypeDescription
phoneNumberExtensionAdsApp.PhoneNumberThe phone number to remove from this ad group.

removePrice(priceExtension)

Removes a price extension from this ad group.

Returns nothing.

Arguments:

NameTypeDescription
priceExtensionAdsApp.PriceThe price to remove from this ad group.
Removes a sitelink extension from this ad group.

Returns nothing.

Arguments:

NameTypeDescription
sitelinkExtensionAdsApp.SitelinkThe sitelink to remove from this ad group.

removeSnippet(snippetExtension)

Removes a snippet extension from this ad group.

Returns nothing.

Arguments:

NameTypeDescription
snippetExtensionAdsApp.SnippetThe snippet to remove from this ad group.

setMobileBidModifier(modifier)

Sets the mobile bid modifier for this ad group to the specified value.

The bid modifier is a multiplier applied to the ad group's bids on mobile devices. So, for instance, a bid modifier of 1.1 increases the bid to 110% of its original value, and changes a bid of $5.00 to $5.50.

The operation will fail if the ad group's campaign has a mobile bid modifier of -1 (i.e. -100%). Setting a campaign mobile bid modifier to -1 will opt the entire campaign out of mobile.

Note that when you set a mobile bid modifier at both campaign- and ad group-level in a single campaign, the ad group mobile bid modifier will be used when determining your bid UNLESS the campaign mobile bid modifier is set to -1 (i.e. -100%) which will opt the entire campaign out of mobile regardless of any ad group mobile bid modifiers that may be set.

For more information about bid modifiers, please see the Google Ads Help Center article.

Returns nothing.

Arguments:

NameTypeDescription
modifierdoubleThe new mobile bid modifier.

setName(name)

Sets the name of the ad group.

Returns nothing.

Arguments:

NameTypeDescription
nameStringThe new name for the ad group.

targeting()

Provides access to ad group-level targeting criteria: audiences. SearchAdGroupAudience, SearchAdGroupExcludedAudience,

Return values:

TypeDescription
AdsApp.AdGroupTargetingAccess to certain kinds of targeting criteria in this ad group.

urls()

Provides access to this ad group's URL fields. See Using Upgraded URLs for more information.

Return values:

TypeDescription
AdsApp.AdGroupUrlsAccess to this ad group's URL fields.