建立使用者名單

如果是 expression_rule_user_list,還有一項額外差異。根據預設,Google Ads 會將規則項目群組中的所有規則項目AND合併在一起。也就是說,至少一個規則項目群組中的每個規則項目必須相符,規則才會將訪客加入名單。這就是所謂的「幹擾標準形式」,或稱為 OR_OF_ANDS

另一種做法是設定名單,只在每個規則項目群組至少有一個規則項目相符時,將訪客加入名單。這種行為稱為「接續一般形式」(即 AND_OF_ORS),且可以透過 rule_type 欄位用於 expression_rule_user_list。如果嘗試將 AND_OF_ORS 用於 date_specific_rule_user_list,將會導致錯誤。

最後,只要將上述規則項目群組合併為新的使用者名單即可。在此情況下,我們將保留預設的 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' => []
]);
      

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 = (
    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 = 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::V16::Common::FlexibleRuleUserListInfo->new({
    inclusiveRuleOperator => AND,
    inclusiveOperands     => [
      Google::Ads::GoogleAds::V16::Common::FlexibleRuleOperandInfo->new({
          rule => Google::Ads::GoogleAds::V16::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 => []});
      

依網站造訪日期範圍限制

上述的 expression_rule_user_list 符合您的需求,但如果您只想吸引符合名單中規則的使用者,在 10 月 1 日至 12 月 31 日之間造訪您的網站,該怎麼做?使用 date_specific_rule_user_list

建立 date_specific_rule_user_list 的程序與您對 expression_rule_user_list 採取的相同程序相同。請使用 DateSpecificRuleUserListInfo 物件設定 date_specific_rule_user_list 欄位,而不要設定 RuleBasedUserListInfo 物件的 expression_rule_user_list 欄位。這個物件將包含 start_dateend_date 的欄位。

DateSpecificRuleUserListInfo dateSpecificRuleUserListInfo =
    DateSpecificRuleUserListInfo.newBuilder()
        .setRule(
            UserListRuleInfo.newBuilder()
                .addAllRuleItemGroups(
                    ImmutableList.of(checkoutAndCartSizeRuleGroup, checkoutDateRuleGroup)))
        .setStartDate(StringValue.of("2019-10-01"))
        .setEndDate(StringValue.of("2019-12-31"))
        .build();

新的名單會納入所有符合與之前名單規則的使用者,但前提是他們造訪您網站的時間介於 start_date (含) 至 end_date (含) 之間。

將過去的使用者納入名單

您也可以將使用者清單的 prepopulation_status 設為 REQUESTED,藉此在以規則為準的使用者名單中納入過去的使用者,並定期檢查這個欄位的狀態,監控非同步預先填入程序的進度。

視名單的再行銷效期及加入再行銷代碼的日期而定,系統只會加入最近 30 天內過去的使用者。要求處理完畢之後,狀態會更新為 FINISHED;如果要求失敗,狀態則會更新為 FAILED