包含用于筛选和排序市场活动排除受众列表的方法。 有关选择器的信息,请参阅 选择器。
用法示例:
// 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();
// Gets the iterator that iterates all campaign excluded audiences
// in the campaign excluded audience.
var audienceIterator = campaign.targeting().excludedAudiences()
.withLimit(10)
.withIds("123456789")
.get();
// Loops through all campaign excluded audiences in the campaign excluded audience.
while (audienceIterator.hasNext()) {
var audience = audienceIterator.next();
}
}
方法
| 方法名称 | 返回类型 | 说明 |
|---|---|---|
| get | CampaignExcludedAudienceIterator | 获取用于循环访问市场活动排除受众列表的迭代器。 |
| orderBy (字符串 orderBy) | CampaignExcludedAudienceSelector | 将指定的排序应用于所选市场活动排除的受众。 |
| withCondition (字符串条件) | CampaignExcludedAudienceSelector | 将筛选条件应用于市场活动排除的受众。 |
| withIds (string[] ids) | CampaignExcludedAudienceSelector | 获取具有指定 ID 的市场活动排除受众。 |
| withLimit (int limit) | CampaignExcludedAudienceSelector | 获取与选择条件匹配的前 n 个 市场活动排除受众。 |
获取
获取用于循环访问市场活动排除受众列表的迭代 器 。
返回
| 类型 | 说明 |
|---|---|
| CampaignExcludedAudienceIterator | 用于循环访问所选市场活动排除的受众的迭代器。 |
orderBy (String orderBy)
将指定的排序应用于所选市场活动排除的受众。
在“columnName orderDirection”窗体中指定 orderBy 参数,其中:
- columnName 是 受支持的列之一。
- orderDirection 是对结果进行排序的顺序。 设置为 ASC 可按升序对结果进行排序,或设置为 DESC 以按降序对结果进行排序。 默认值为 ASC。
例如,以下调用按 AverageCpc 按升序返回市场活动排除的受众。
selector = selector.orderBy("AverageCpc");
选择器仅支持按一个字段对实体进行排序。 不能按字段 x 对实体列表进行排序,在 x 中按字段 y 排序,等等。 如果在链或单独的选择器调用中指定多个 orderBy() 调用,则脚本将使用上次 orderBy() 调用中指定的字段对实体列表进行排序。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
| orderBy | string | 要应用的排序。 |
返回
| 类型 | 说明 |
|---|---|
| CampaignExcludedAudienceSelector | 应用了排序的选择器。 |
withCondition (字符串条件)
将筛选条件应用于市场活动排除的受众。
以“columnName 运算符值”的形式指定 条件 参数,其中:
运算符
使用的运算符取决于列的类型。 运算符区分大小写。 例如,使用 STARTS_WITH 而不是 starts_with。
包含整数和长值的列的运算符:
<
<=
>
>=
=
!=
包含双精度值的列的运算符:
<
>
包含字符串值的列的运算符:
=
!=
STARTS_WITH
STARTS_WITH_IGNORE_CASE
CONTAINS
CONTAINS_IGNORE_CASE
DOES_NOT_CONTAIN
DOES_NOT_CONTAIN_IGNORE_CASE
包含枚举值的列的运算符:
=
!=
IN []
NOT_IN []
包含字符串数组的列的运算符:
CONTAINS_ALL
CONTAINS_ANY
CONTAINS_NONE
支持的列
市场活动排除的受众筛选支持的列。 名称区分大小写。
下面是可以指定的实体属性。
| Column | 类型 | 示例 |
|---|---|---|
| AudienceId | long | 关联的受众的 ID。withCondition("AudienceId = 123456789") |
| CampaignName | string | 协会的竞选活动的名称。withCondition("CampaignName CONTAINS_IGNORE_CASE 'truck'") |
| CampaignStatus | 枚举 | 协会活动的状态。 可能区分大小写的值包括:
withCondition("CampaignStatus = PAUSED") |
| 状态 | 枚举 | 关联的状态。 可能区分大小写的值包括:
withCondition("Status = ENABLED") |
| UserListName | string | 关联的访问群体的名称。withCondition("UserListName = 'foo'") |
参数
| 名称 | 类型 | 说明 |
|---|---|---|
| 条件 | string | 要应用于选择器的条件。 |
返回
| 类型 | 说明 |
|---|---|
| CampaignExcludedAudienceSelector | 应用了条件的选择器。 |
withIds (string[] ids)
获取具有指定 ID 的市场活动排除受众。
可以将一个或多个条件应用于选择器。 条件链被视为 AND 操作。 例如,仅当条件 A 为 true 且条件 B 为 true 时,才会选择实体。 例如,以下调用仅选择市场活动排除的受众 33333。
var selector = AdsApp.adGroups()
.withIds(['11111', '22222', '33333'])
.withIds(['33333', '44444', '55555']);
参数
| 名称 | 类型 | 说明 |
|---|---|---|
| ids | string[] | 市场活动排除受众 ID 的数组。 有关限制,请参阅 脚本执行限制。 |
返回
| 类型 | 说明 |
|---|---|
| CampaignExcludedAudienceSelector | 应用了 ID 的选择器。 |
withLimit (int 限制)
获取与选择条件匹配的前 n 个 市场活动排除受众。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
| limit | int | 要返回的已排除市场活动受众的数量。 实际数字可能更少。 |
返回
| 类型 | 说明 |
|---|---|
| CampaignExcludedAudienceSelector | 应用了限制的选择器。 |