AI-generated Key Takeaways
-
The
AdGroupBuilder
helps create new ad groups within a campaign, allowing you to set various parameters like name, status, and bids. -
You can define custom parameters and tracking templates for advanced tracking and URL management directly within the ad group.
-
Bidding strategies can be set using methods like
withCpa
,withCpc
, andwithCpm
, with default values if not explicitly defined. -
The
build()
method finalizes the ad group creation and returns anAdGroupOperation
to access the new ad group or any errors during creation.
Typical usage:
var adGroupBuilder = campaign.newAdGroupBuilder(); var adGroupOperation = adGroupBuilder .withName("ad group name") .withStatus("PAUSED") .build(); var adGroup = adGroupOperation.getResult();
Methods:
Member | Type | Description |
---|---|---|
build() | AdsApp.AdGroupOperation |
Creates an AdGroup. |
withCpa(cpa) | AdsApp.AdGroupBuilder |
Sets the Target CPA bid of the new ad group to the specified value. |
withCpc(cpc) | AdsApp.AdGroupBuilder |
Sets the max CPC bid of the new ad group to the specified value. |
withCpm(cpm) | AdsApp.AdGroupBuilder |
Sets the CPM bid of the new ad group to the specified value. |
withCustomParameters(customParameters) | AdsApp.AdGroupBuilder |
Sets the custom parameters of the new ad group to the specified value. |
withFinalUrlSuffix(suffix) | AdsApp.AdGroupBuilder |
Sets the final URL suffix of the new ad group to the specified value. |
withName(name) | AdsApp.AdGroupBuilder |
Sets the name of the new ad group to the specified value. |
withStatus(status) | AdsApp.AdGroupBuilder |
Sets the status of the new ad group to the specified value. |
withTrackingTemplate(trackingTemplate) | AdsApp.AdGroupBuilder |
Sets the tracking template of the new ad group to the specified value. |
build()
Creates an AdGroup. Returns an AdGroupOperation that can be used
to get the new ad group (or access any associated errors if creation
failed). Return values:
Type | Description |
---|---|
AdsApp.AdGroupOperation |
The associated ad group operation. |
withCpa(cpa)
Sets the Target CPA bid of the new ad group to the specified
value.
If the bid is not set, the ad group will assume a default Target CPA bid of $0.01.
Arguments:
Name | Type | Description |
---|---|---|
cpa | double |
The Target CPA bid of the ad group. |
Return values:
Type | Description |
---|---|
AdsApp.AdGroupBuilder |
The ad group builder with the specified Target CPA. |
withCpc(cpc)
Sets the max CPC bid of the new ad group to the specified value.
If the bid is not set, the ad group will assume a default max CPC bid of $0.01.
Arguments:
Name | Type | Description |
---|---|---|
cpc | double |
The max CPC bid of the ad group. |
Return values:
Type | Description |
---|---|
AdsApp.AdGroupBuilder |
The ad group builder with the specified max CPC. |
withCpm(cpm)
Sets the CPM bid of the new ad group to the specified value.
See Cost-per-thousand impressions (CPM) for more information.
If the bid is not set, the ad group will assume a default CPM bid of $0.25.
Arguments:
Name | Type | Description |
---|---|---|
cpm | double |
The CPM bid of the ad group. |
Return values:
Type | Description |
---|---|
AdsApp.AdGroupBuilder |
The ad group builder with the specified CPM. |
withCustomParameters(customParameters)
Sets the custom parameters of the new ad group to the specified
value.
Custom parameters enable you to create your own ValueTrack parameters that you can assign your own IDs to.
The name of a custom parameter can contain only alphanumeric characters,
and custom parameter values may not contain white space. When referring to
the custom parameter in final URLs and tracking template, you should
surround the custom parameter in braces, and prefix an underscore to its
name, e.g. {_param}
.
You can have up to 8 custom parameters for an entity. The key and value must not exceed 16 and 200 bytes respectively.
Custom parameters specified at a lower level entity will override the setting specified at a higher level entity, e.g., setting custom parameters at the ad group level overrides the setting at the campaign level, and custom parameters specified at the ad level override the setting at the ad group level.
See Using Upgraded URLs for more information.
Arguments:
Name | Type | Description |
---|---|---|
customParameters | Object |
The custom parameters of the ad group as
a map of the following form: {key1: 'value1', key2: 'value2',
key3: 'value3'} . |
Return values:
Type | Description |
---|---|
AdsApp.AdGroupBuilder |
The ad group builder with the specified custom parameters. |
withFinalUrlSuffix(suffix)
Sets the final URL suffix of the new ad group to the specified
value.
When parallel tracking is enabled, the final URL suffix gets appended to the final URL.
Arguments:
Name | Type | Description |
---|---|---|
suffix | String |
The final URL suffix to set on the ad group. |
Return values:
Type | Description |
---|---|
AdsApp.AdGroupBuilder |
The ad group builder with the specified final URL suffix. |
withName(name)
Sets the name of the new ad group to the specified value. Creation will
fail if a name is not specified. Arguments:
Name | Type | Description |
---|---|---|
name | String |
Ad group name. |
Return values:
Type | Description |
---|---|
AdsApp.AdGroupBuilder |
Ad group builder with the specified name. |
withStatus(status)
Sets the status of the new ad group to the specified value. If the status
is not set, it will default to ENABLED
. Arguments:
Name | Type | Description |
---|---|---|
status | String |
Ad group status. |
Return values:
Type | Description |
---|---|
AdsApp.AdGroupBuilder |
Ad group builder with the specified status. |
withTrackingTemplate(trackingTemplate)
Sets the tracking template of the new ad group to the specified
value.
You can optionally use the tracking template to specify additional tracking parameters or redirects. Google Ads will use this template to assemble the actual destination URL to associate with the ad.
A tracking template specified at a lower level entity will override the setting specified at a higher level entity, e.g., a tracking template set at the ad group level overrides the setting at the campaign level, and a tracking template specified at the ad level overrides the setting at the ad group level.
See Using Upgraded URLs for more information.
Arguments:
Name | Type | Description |
---|---|---|
trackingTemplate | String |
The tracking template for the ad group. |
Return values:
Type | Description |
---|---|
AdsApp.AdGroupBuilder |
The ad group builder with the specified tracking template. |