← 返回目录
来源:Google Ads API 官方文档 · 中文版 · 本地归档

创建用户名单

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

基于规则的用户名单

使用 flexible_rule_user_list 构建的基于规则的用户列表可以包含多条规则。每条规则都由 UserListRuleInfo 消息表示,该消息具有 rule_type,用于指定如何组合规则项组中的规则项。

如果 rule_type 为 OR_OF_ANDS(默认值),Google Ads 会将规则项组中的所有规则项进行 AND 运算。这意味着,对于给定的规则,至少一个规则项组中的每个规则项都必须匹配,规则才能得到满足。这称为“析取范式”。

或者,如果您将 rule_type 设置为 AND_OF_ORS,则每个规则项组中必须有至少一个规则项匹配,规则才能满足。这称为“合取范式”。

现在,只要将上述规则项目组合并成新的用户列表即可。在这种情况下,我们将保留默认的 OR_OF_ANDS 功能,因为我们正是为此构建了这些规则。

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' => []
]);
在接这个接口时卡住了?
Stuck wiring this API into production? We build ad-delivery tooling on these platforms — campaign automation, reporting pipelines, error-handling and migration between API versions.
联系我们 · Talk to us 每日平台更新简报 →