// 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`);
}
}
}