建立使用者清單

您可以在再行銷廣告活動中使用使用者名單,再次接觸曾在網站或應用程式中執行特定動作的使用者。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)
      

小茹

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::V26::Common::FlexibleRuleUserListInfo->new({
    inclusiveRuleOperator => AND,
    inclusiveOperands     => [
      Google::Ads::GoogleAds::V26::Common::FlexibleRuleOperandInfo->new({
          rule => Google::Ads::GoogleAds::V26::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,將過去的網站訪客或應用程式使用者納入規則式使用者名單 (僅限多媒體廣告聯播網支援),並定期檢查這個欄位的狀態,監控非同步預先填入程序的進度。

預先填入功能只會根據名單的 membership_life_span (1 到 540 天) 和再行銷代碼的加入日期,新增過去 30 天內的使用者。要求處理完畢後,狀態會更新為 FINISHED;如果要求失敗,則會更新為 FAILED。

指定使用者名單並調整出價

建立 UserList 後,請將其資源名稱附加至 AdGroupCriterion 或 CampaignCriterion,並設定 bid_modifier (例如,1.25 代表出價提高 25%)。如需示範如何指定目標使用者名單及修改出價的程式碼範例,請參閱「指定目標名單」。