Contains the methods used to define and add an ad group. For information about builders, see Builders.
Example usage:
// Get a campaign to add the ad group to.
var iterator = AdsApp.campaigns()
.withIds(['CAMPAIGN ID GOES HERE'])
.get();
while (iterator.hasNext()) {
var campaign = iterator.next();
// Get the campaign's ad group builder and add an ad group.
var operation = campaign.newAdGroupBuilder()
.withName("AD GROUP NAME GOES HERE")
.withStatus("ENABLED")
.build();
// See the Builders topic for performance considerations
// when using the operation object's methods.
if (!operation.isSuccessful()) {
for (var error of operation.getErrors()) {
Logger.log(`${error}\n`);
}
}
}
Ad group builder with the bidding strategy applied.
withCpc(double cpc)
Sets the ad group's CPC bid.
Specifies the bid amount to use when the keyword matches the user's search term and the ad group's bid strategy is MANUAL_CPC. This bid is used if a lower-level entity such as keyword does not override it.
Arguments
Name
Type
Description
cpc
double
The ad group's maximum CPC bid. The account's currency determines the minimum and maximum bid values. For more information, see Bid and budget currencies.
Specifies the bid amount to use per 1,000 viewed impressions, and when the ad group's bid strategy is MANUAL_CPM.
Arguments
Name
Type
Description
cpm
double
The ad group's maximum CPM bid. The account's currency determines the minimum and maximum bid values. For more information, see Bid and budget currencies.
Specifies the bid amount to use per view or per click on a video ad, and when the ad group's bid strategy is MANUAL_CPV.
Arguments
Name
Type
Description
cpv
double
The ad group's maximum CPV bid. The account's currency determines the minimum and maximum bid values. For more information, see Bid and budget currencies.
Sets the ad group's custom parameters to use in final URLs or tracking templates.
Custom parameters are helpful with sharing dynamic information across multiple URLs. For more information about its usage, see Custom Parameters.
Arguments
Name
Type
Description
customParameters
Object
A map of up to three custom parameters to apply to the ad group. For example, {key1: 'value1', key2: 'value2', key3: 'value3'}, where key is the custom parameter's name and value is the parameter's value. The name may contain a maximum of 16 8-byte characters and the value may contain a maximum of 200 8-byte characters.
By default, the ad group inherits the language from its parent campaign. Specify a language at the ad group level to override the language specified at the campaign level or if the campaign doesn't specify a language (language must be specified at the campaign and/or ad group level).
Arguments
Name
Type
Description
language
string
The language used by ads in the ad group. For example, English. The string is case insensitive. Do not use a two-character language code. For a list of supported languages, see Ad Languages.
The ad group's name. The name is required. The name may contain a maximum of 256 characters and must be unique amongst all active ad groups in the campaign.
Sets the date when ads in the ad group start serving. Call this method only if you want ads in the group to start serving on a specific date; otherwise, ads start serving immediately.
Arguments
Name
Type
Description
endDate
string
The date to start serving ads. Specify the date in the form, YYYYMMDD.
Sets the date when ads in the ad group start serving. Call this method only if you want ads in the group to start serving on a specific date; otherwise, ads start serving immediately.
Arguments
Name
Type
Description
endDate
Object
The date to start serving ads. Specify the date using an object with the following fields:
year
month
day
For example: var date = {year: 2018, month: 5, day: 13};
The month is one-based where 1 is January and 12 is December.
Tracking templates are used with the keyword's FinalUrl to create the destination URL used by the ad. For more information, see What tracking or URL parameters can I use?