Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Contains the methods for defining and creating a campaign audience association. For information about builders, see Builders.
Example usage:
// Gets the iterator that iterates all campaigns
// in the account.
var shoppingCampaign = AdsApp.shoppingCampaigns().withIds(["123456789"]).get();
// Loops through all campaigns in the account.
while (iterator.hasNext()) {
var campaign = iterator.next();
// Get the campaign audience's builder.
var operation = campaign.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
Method Name | Return Type | Description |
---|---|---|
build | CampaignAudienceOperation | Creates the campaign audience association and returns an operation object used to check whether the campaign audience association was successfully added. |
exclude | CampaignExcludedAudienceOperation | Excludes the specified audience from this campaign and returns an operation object used to check whether the excluded campaign audience was successfully added. |
withAudience(Object userList) | CampaignAudienceBuilder | Sets the associated user list. |
withAudienceId(string audienceId) | CampaignAudienceBuilder | Sets the associated audience's ID. |
withAudienceType(string audienceType) | CampaignAudienceBuilder | Sets the associated audience's type. |
withBidModifier(double modifier) | CampaignAudienceBuilder | Sets the association's bid modifier. |
build
Creates the campaign audience and returns an operation object used to check whether the campaign audience was successfully added.
Returns
Type | Description |
---|---|
CampaignAudienceOperation | An operation object used to check whether the campaign audience was successfully added. |
exclude
Excludes the specified audience from this campaign and returns an operation object used to check whether the excluded campaign audience was successfully added.
Returns
Type | Description |
---|---|
CampaignExcludedAudienceOperation | An operation object used to check whether the excluded campaign audience was successfully added. |
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
Type | Description |
---|---|
CampaignAudienceBuilder | The campaign audience builder with the bid modifier applied. |
Returns
Type | Description |
---|---|
CampaignAudienceBuilder | The campaign audience builder with the name applied. |