Tạo Danh sách người dùng

Đối với expression_rule_user_list, cần có thêm một sự khác biệt cần thực hiện. Theo mặc định, Google Ads sẽ AND tất cả các mục quy tắc trong một nhóm mục quy tắc. Điều này có nghĩa là mọi mục quy tắc trong ít nhất một nhóm mục quy tắc phải khớp để quy tắc có thể thêm khách truy cập vào danh sách. Đây được gọi là "dạng thông thường phân biệt" hay OR_OF_ANDS.

Ngoài ra, bạn có thể thiết lập danh sách để chỉ thêm khách truy cập vào danh sách nếu ít nhất một mục quy tắc trong mỗi nhóm mục quy tắc khớp. Đây được gọi là "dạng thông thường kết hợp" hay AND_OF_ORS và có sẵn cho expression_rule_user_list bằng cách sử dụng trường rule_type. Việc cố gắng sử dụng AND_OF_ORS cho date_specific_rule_user_list sẽ dẫn đến lỗi.

Bạn chỉ cần kết hợp các nhóm mục quy tắc ở trên vào một danh sách người dùng mới. Trong trường hợp này, chúng ta sẽ giữ nguyên chức năng OR_OF_ANDS mặc định, vì đó là mục đích mà chúng tôi đã xây dựng các quy tắc này.

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);
      

1.199

$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 => []});
      

Giới hạn theo phạm vi ngày truy cập vào trang web

expression_rule_user_list ở trên đáp ứng được nhu cầu của bạn, nhưng nếu bạn chỉ muốn thu hút những người dùng đáp ứng quy tắc trong danh sách đó và truy cập vào trang web của bạn trong khoảng thời gian từ ngày 1 tháng 10 đến ngày 31 tháng 12 thì sao? Sử dụng date_specific_rule_user_list.

Việc tạo date_specific_rule_user_list tuân theo quy trình tương tự mà bạn thực hiện đối với expression_rule_user_list. Thay vì đặt trường expression_rule_user_list của đối tượng RuleBasedUserListInfo, hãy đặt trường date_specific_rule_user_list bằng đối tượng DateSpecificRuleUserListInfo. Đối tượng này sẽ chứa các trường cho 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();

Danh sách mới sẽ chứa tất cả người dùng đáp ứng các quy tắc giống như danh sách trước đó, nhưng chỉ khi họ truy cập vào trang web của bạn trong khoảng thời gian từ start_date (bao gồm) đến end_date (bao gồm).

Đưa người dùng cũ vào danh sách

Bạn cũng có thể đưa những người dùng trước đây vào danh sách người dùng dựa trên quy tắc bằng cách đặt prepopulation_status của danh sách người dùng thành REQUESTED và theo dõi tiến trình của quá trình điền sẵn không đồng bộ bằng cách kiểm tra định kỳ trạng thái của trường này.

Việc này sẽ chỉ thêm người dùng trước đây trong vòng 30 ngày qua, tuỳ thuộc vào thời hạn thành viên của danh sách và ngày thêm thẻ tái tiếp thị. Trạng thái sẽ được cập nhật thành FINISHED sau khi yêu cầu được xử lý hoặc FAILED nếu yêu cầu không thành công.