创建用户名单

您可以在再营销广告系列中使用用户名单,以重新吸引在您的网站或应用中执行过特定操作的用户。Google Ads API 支持多种类型的用户名单。本指南重点介绍如何使用创建规则项组中定义的规则项组来创建基于规则的用户列表。

基于规则的用户名单

使用 flexible_rule_user_list 构建的基于规则的用户列表可以包含多条规则(inclusive_rule 和 exclusive_rule,通过 inclusive_rule_operator 联接)。每条规则都由 UserListRuleInfo 消息表示,该消息具有 rule_type 字段,用于指定如何组合规则项组中的规则项。

虽然 UserListRuleTypeEnum 同时定义了OR_OF_ANDS(析取范式)和 AND_OF_ORS(合取范式),但 OR_OF_ANDS 是 FlexibleRuleUserListInfo 唯一支持的 rule_type(设置 AND_OF_ORS 会返回 UserListError.RULE_TYPE_IS_NOT_SUPPORTED)。使用 OR_OF_ANDS 时,Google Ads 会将规则项组中的所有规则项进行 AND 运算,这意味着对于给定的规则,至少一个规则项组中的每个规则项都必须匹配,规则才能得到满足。

在创建规则项组中定义两个 UserListRuleItemGroupInfo 对象后,将它们合并到一个新的用户列表中。以下代码示例保留了默认的 OR_OF_ANDS 规则类型,将两个规则项组都添加到了 FlexibleRuleUserListInfo 上的 FlexibleRuleOperandInfo 中,并更改了用户列表:

Java

FlexibleRuleUserListInfo flexibleRuleUserListInfo =
    FlexibleRuleUserListInfo.newBuilder()
        .setInclusiveRuleOperator(UserListFlexibleRuleOperator.AND)
        .addInclusiveOperands(
            FlexibleRuleOperandInfo.newBuilder()
                .setRule(
                    // The default rule_type for a UserListRuleInfo object is OR of ANDs
                    // (disjunctive normal form). That is, rule items will be ANDed together
                    // within rule item groups and the groups themselves will be ORed together.
                    UserListRuleInfo.newBuilder()
                        .addRuleItemGroups(checkoutDateRuleGroup)
                        .addRuleItemGroups(checkoutAndCartSizeRuleGroup))
                // Optional: includes a lookback window for this rule, in days.
                .setLookbackWindowDays(7L))
        .build();
      

C#

FlexibleRuleUserListInfo flexibleRuleUserListInfo = new FlexibleRuleUserListInfo();
FlexibleRuleOperandInfo flexibleRuleOperandInfo = new FlexibleRuleOperandInfo() {
    Rule = new UserListRuleInfo()
};
flexibleRuleOperandInfo.Rule.RuleItemGroups.Add(checkoutAndCartSizeRuleGroup);
flexibleRuleOperandInfo.Rule.RuleItemGroups.Add(checkoutDateRuleGroup);
flexibleRuleUserListInfo.InclusiveOperands.Add(flexibleRuleOperandInfo);
      

PHP

$flexibleRuleUserListInfo = new FlexibleRuleUserListInfo(
    [
    'inclusive_rule_operator' => UserListFlexibleRuleOperator::PBAND,
    'inclusive_operands' => [
        new FlexibleRuleOperandInfo(
            [
            'rule' => new UserListRuleInfo(
                [
                // The default rule_type for a UserListRuleInfo object is OR of ANDs
                // (disjunctive normal form). That is, rule items will be ANDed together
                // within rule item groups and the groups themselves will be ORed together.
                'rule_item_groups' => [
                    $checkoutAndCartSizeRuleGroup,
                    $checkoutDateRuleGroup
                ]
                ]
            ),
            // Optionally add a lookback window for this rule, in days.
            'lookback_window_days' => 7
            ]
        )
    ],
    'exclusive_operands' => []
    ]
);
      

Python

# Create a FlexibleRuleUserListInfo object, or a flexible rule
# representation of visitors with one or multiple actions.
# FlexibleRuleUserListInfo wraps UserListRuleInfo in a
# FlexibleRuleOperandInfo object that represents which user lists to
# include or exclude.
flexible_rule_user_list_info: FlexibleRuleUserListInfo = (
    rule_based_user_list_info.flexible_rule_user_list
)
flexible_rule_user_list_info.inclusive_rule_operator = (
    client.enums.UserListFlexibleRuleOperatorEnum.AND
)
# The default rule_type for a UserListRuleInfo object is OR of
# ANDs (disjunctive normal form). That is, rule items will be
# ANDed together within rule item groups and the groups
# themselves will be ORed together.
rule_operand: FlexibleRuleOperandInfo = client.get_type(
    "FlexibleRuleOperandInfo"
)
rule_operand.rule.rule_item_groups.extend(
    [
        checkout_and_cart_size_rule_group,
        checkout_date_rule_group,
    ]
)
rule_operand.lookback_window_days = 7
flexible_rule_user_list_info.inclusive_operands.append(rule_operand)
      

Ruby

r.flexible_rule_user_list = client.resource.flexible_rule_user_list_info do |frul|
  frul.inclusive_rule_operator = :AND
  frul.inclusive_operands << client.resource.flexible_rule_operand_info do |froi|
    froi.rule = client.resource.user_list_rule_info do |info|
      info.rule_item_groups += [checkout_date_rule_group, checkout_and_cart_size_rule_group]
    end
    # Optionally include a lookback window for this rule, in days.
    froi.lookback_window_days = 7
  end
end
      

Perl

my $flexible_rule_user_list_info =
  Google::Ads::GoogleAds::V25::Common::FlexibleRuleUserListInfo->new({
    inclusiveRuleOperator => AND,
    inclusiveOperands     => [
      Google::Ads::GoogleAds::V25::Common::FlexibleRuleOperandInfo->new({
          rule => Google::Ads::GoogleAds::V25::Common::UserListRuleInfo->new({
              # The default rule_type for a UserListRuleInfo object is OR of
              # ANDs (disjunctive normal form). That is, rule items will be
              # ANDed together within rule item groups and the groups
              # themselves will be ORed together.
              ruleItemGroups => [
                $checkout_date_rule_group, $checkout_and_cart_size_rule_group
              ]}
          ),
          # Optionally include a lookback window for this rule, in days.
          lookback_window_days => 7
        })
    ],
    exclusiveOperands => []});
      

curl

在基于规则的名单中包含过往用户

您还可以通过将用户名单的 prepopulation_status 设置为 REQUESTED,将过往网站访问者或应用用户纳入基于规则的用户名单中(仅在展示广告网络中受支持),并通过定期检查此字段的状态来监控异步预填充过程的进度。

预填充只会添加过去 30 天内的过往用户,具体取决于名单的membership_life_span(从 1 天到 540 天)以及再营销代码的添加日期。请求处理完毕后,状态会更新为 FINISHED;如果请求失败,状态会更新为 FAILED。

定位用户名单并调整出价

创建 UserList 后,将其资源名称附加到 AdGroupCriterion 或 CampaignCriterion,并设置 bid_modifier(例如,1.25 表示出价提高 25%)。如需查看演示如何定位用户列表和修改出价的代码示例,请参阅定位列表。