AdsApp.​ExcludedPlacementSelector

Fetches excluded placements. Supports filtering and sorting.

Typical usage:

var adGroup = AdsApp.adGroups().get().next();
var excludedPlacementSelector = adGroup.display().excludedPlacements();

var excludedPlacementIterator = excludedPlacementSelector.get();
while (excludedPlacementIterator.hasNext()) {
  var excludedPlacement = excludedPlacementIterator.next();
}
Related:

Methods:

MemberTypeDescription
getAdsApp.ExcludedPlacementIteratorFetches the requested excluded placements and returns an iterator.
orderByAdsApp.ExcludedPlacementSelectorSpecifies the ordering of the resulting entities.
withConditionAdsApp.ExcludedPlacementSelectorAdds the specified condition to the selector in order to narrow down the results.
withLimitAdsApp.ExcludedPlacementSelectorSpecifies limit for the selector to use.

get()

Fetches the requested excluded placements and returns an iterator.

Return values:

TypeDescription
AdsApp.ExcludedPlacementIteratorIterator of the requested excluded placements.

orderBy(orderBy)

Specifies the ordering of the resulting entities. orderBy parameter can have one of the following forms:
  • orderBy("ad_group_criterion.placement.url") - orders results by url, in ascending order.
  • orderBy("ad_group_criterion.placement.url ASC") - orders results by url, in ascending order.
  • orderBy("ad_group_criterion.placement.url DESC") - orders results by url, in descending order.

See ExcludedPlacementSelector.withCondition(String) for enumeration of columns that can be used.

orderBy() may be called multiple times. Consider the following example:

selector = selector.
    .orderBy("ad_group_criterion.placement.url")
    .orderBy("ad_group.name");

The results will be ordered by ad_group_criterion.placement.url in ascending order. Results with equal ad_group_criterion.placement.url value will be ordered by ad_group.name in ascending order.

Arguments:

NameTypeDescription
orderByStringOrdering to apply.

Return values:

TypeDescription
AdsApp.ExcludedPlacementSelectorThe selector with ordering applied.

withCondition(condition)

Adds the specified condition to the selector in order to narrow down the results.

Multiple conditions may be added to the same selector:

selector = selector
    .withCondition("ad_group_criterion.placement.url CONTAINS 'test'")
    .withCondition("ad_group.status NOT IN [PAUSED]");
All specified conditions are AND-ed together. The above example will retrieve excluded placements that contain 'test' and are in ad groups that are not paused.

The parameter to be passed into this method must be of the following form:

"COLUMN_NAME OPERATOR VALUE"

Operators

The operator that can be used in a condition depends on the type of column.
  • For String columns (e.g. ad_group_criterion.placement.url):
    =  != (NOT) (LIKE | CONTAINS | REGEXP_MATCH)
  • For Enumeration columns (ones that can only take one value from a pre-defined list, such as ad_group.status):
    =  !=  IN () NOT IN ()
Conditions using IN, NOT IN, CONTAINS ALL, CONTAINS ANY and CONTAINS NONE operators look as follows:
withCondition("ad_group.status IN (Value1, Value2)")

Columns

All column names are case-sensitive, and so are all values of enumerated columns (such as ad_group.status)

ColumnTypeExample
Excluded placement attributes
ad_group_criterion.placement.urlStringwithCondition("ad_group_criterion.placement.url CONTAINS 'test'")
ad_group.nameStringwithCondition("ad_group.name REGEXP_MATCH '.*shoes.*'")
ad_group.statusEnumeration: ENABLED, PAUSED, REMOVEDwithCondition("ad_group.status = ENABLED"). Use to fetch excluded placements from only ENABLED ad groups.
campaign.nameStringwithCondition("campaign.name REGEXP_MATCH '.*promotion.*'")
campaign.statusEnumeration: ENABLED, PAUSED, REMOVEDwithCondition("campaign.status = ENABLED"). Use to fetch excluded placements keywords from only ENABLED campaigns.

Arguments:

NameTypeDescription
conditionStringCondition to add to the selector.

Return values:

TypeDescription
AdsApp.ExcludedPlacementSelectorThe selector with the condition applied.

withLimit(limit)

Specifies limit for the selector to use. For instance, withLimit(50) returns only the first 50 entities.

Arguments:

NameTypeDescription
limitintHow many entities to return.

Return values:

TypeDescription
AdsApp.ExcludedPlacementSelectorThe selector with limit applied.