Contains the methods for defining and creating an ad group audience association. For information about builders, see Builders.
Example usage:
// Gets the iterator that iterates all ad groups
// in the account.
var iterator = AdsApp.adGroups().get();
// Loops through all ad groups in the account.
while (iterator.hasNext()) {
var adGroup = iterator.next();
// Get the ad group audience's builder.
var operation = adGroup.targeting().newUserListBuilder()
.withAudienceId("AUDIENCE ID GOES HERE")
.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`);
}
}
}
Methods
build
Creates the ad group audience and returns an operation object used to check whether the ad group audience was successfully added.
Returns
| Type |
Description |
| AdGroupAudienceOperation |
An operation object used to check whether the ad group audience was successfully added. |
exclude
Excludes the specified audience from this ad group and returns an operation object used to check whether the excluded ad group audience was successfully added.
Returns
withAudience(Object userList)
Sets the associated user list.
Arguments
| Name |
Type |
Description |
| userList |
string |
The associated user list. |
withAudienceId(string audienceId)
Sets the associated audience's ID.
Arguments
| Name |
Type |
Description |
| audienceId |
string |
The ID of the associated audience. |
withAudienceType(string audienceType)
Sets the associated audience's type.
Arguments
| Name |
Type |
Description |
| audienceId |
string |
The associated audience's type. |
withBidModifier(double modifier)
Sets the association's bid modifier.
Arguments
| Name |
Type |
Description |
| modifier |
double |
The association's bid modifier. |
Returns
Returns