AdGroupExcludedAudienceSelector

Contains the methods for filtering and sorting a list of ad group excluded audiences. For information about selectors, see Selectors.

Example usage:

    // Gets the iterator that iterates all ad group excluded audiences
    // in the account.
    var iterator = AdsApp.adGroups().get();

    // Loops through all ad groups in the account.
    while (iterator.hasNext()) {
        var adGroup = iterator.next();

        // Gets the iterator that iterates all ad group excluded audiences
        // in the ad group excluded audience.
        var audienceIterator = adGroup.targeting().audiences()
            .withLimit(10)
            .withIds("123456789")
            .get();
    
        // Loops through all ad group excluded audiences in the ad group excluded audience.
        while (audienceIterator.hasNext()) {
            var audience = audienceIterator.next();
        }
    }

Methods

Method Name Return Type Description
get AdGroupExcludedAudienceIterator Gets an iterator used to iterate through the list of ad group excluded audiences.
orderBy(string orderBy) AdGroupExcludedAudienceSelector Applies the specified ordering to the selected ad group excluded audiences.
withCondition(string condition) AdGroupExcludedAudienceSelector Applies filter criteria to the ad group excluded audiences.
withIds(string[] ids) AdGroupExcludedAudienceSelector Gets ad group excluded audiences with the specified IDs.
withLimit(int limit) AdGroupExcludedAudienceSelector Gets the top n ad group excluded audiences that match the selection criteria.

get

Gets an iterator used to iterate through the list of ad group excluded audiences.

Returns

Type Description
AdGroupExcludedAudienceIterator An iterator used to iterate through the selected ad group excluded audiences.

orderBy(String orderBy)

Applies the specified ordering to the selected ad group excluded audiences.

Specify the orderBy parameter in the form, "columnName orderDirection" where:

  • columnName is one of the supported columns.
  • orderDirection is the order to sort the results in. Set to ASC to order the results in ascending order or DESC to order the results in descending order. The default is ASC.

For example, the following call returns ad group excluded audiences in ascending order by AverageCpc.

selector = selector.orderBy("AverageCpc");

Selectors support ordering entities by one field only. You may not order the list of entities by field x, and within x by field y, and so on. If you specify more than one orderBy() call in a chain or in separate selector calls, Scripts orders the list of entities using the field specified in the last orderBy() call. 

Arguments

Name Type Description
orderBy string The ordering to apply.

Returns

Type Description
AdGroupExcludedAudienceSelector Selector with ordering applied.

withCondition(String condition)

Applies filter criteria to the ad group excluded audiences.

Specify the condition parameter in the form, "columnName operator value" where:

Operators

The operator that you use depends on the column's type. Operators are case-sensitive. For example, use STARTS_WITH instead of starts_with.

Operators for columns that contain integers and long values:

<
<=
>
>=
=
!=

Operators for columns that contain double values:

<
>

Operators for columns that contain string values:

=
!=
STARTS_WITH
STARTS_WITH_IGNORE_CASE
CONTAINS
CONTAINS_IGNORE_CASE
DOES_NOT_CONTAIN
DOES_NOT_CONTAIN_IGNORE_CASE

Operators for columns that contain enumeration values:

=
!=
IN []
NOT_IN []

Operators for columns that contain an array of strings:

CONTAINS_ALL
CONTAINS_ANY
CONTAINS_NONE

Supported Columns

Supported columns for ad group excluded audience filtering. The names are case sensitive.

The following are the entity properties you may specify.

Column Type Example
AdGroupName string The name of the association's ad group.

withCondition("AdGroupName CONTAINS_IGNORE_CASE 'truck'")
AdGroupStatus enumeration The status of the association's ad group. Possible case-sensitive values are:
  • ENABLED
  • PAUSED
  • REMOVED
This example returns only ad group excluded audiences whose parent ad group is paused.

withCondition("AdGroupStatus = PAUSED")
AudienceId long The associated audience's ID.

withCondition("AudienceId = 123456789")
CampaignName string The name of the campaign that contains the association's ad group.

withCondition("CampaignName CONTAINS_IGNORE_CASE 'truck'")
CampaignStatus enumeration The status of the campaign that contains the association's ad group. Possible case-sensitive values are:
  • ENABLED
  • PAUSED
  • REMOVED
This example returns only ad group excluded audiences whose parent campaign is paused.

withCondition("CampaignStatus = PAUSED")
Status enumeration The association's status. Possible case-sensitive values are:
  • ENABLED
  • PAUSED
  • REMOVED
This example returns only enabled ad group excluded audiences.

withCondition("Status = ENABLED")
UserListName string The associated audience's name.

withCondition("UserListName = 'foo'")

Arguments

Name Type Description
condition string The condition to apply to the selector.

Returns

Type Description
AdGroupExcludedAudienceSelector Selector with the condition applied.

withIds(string[] ids)

Gets ad group excluded audiences with the specified IDs.

You may apply one or more conditions to a selector. A chain of conditions is considered an AND operation. For example, the entity is selected only if condition A is true AND condition B is true. For example, the following call selects only ad group excluded audience 33333.

var selector = AdsApp.adGroups()
    .withIds(['11111', '22222', '33333'])
    .withIds(['33333', '44444', '55555']);

Arguments

Name Type Description
ids string[] An array of ad group excluded audience IDs. For limits, see Script execution limits.

Returns

Type Description
AdGroupExcludedAudienceSelector Selector with the IDs applied.

withLimit(int limit)

Gets the top n ad group excluded audiences that match the selection criteria.

Arguments

Name Type Description
limit int The number of ad group excluded audiences to return. The actual number may be less.

Returns

Type Description
AdGroupExcludedAudienceSelector Selector with limit applied.