Tạo Danh sách người dùng
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Đối với expression_rule_user_list
, bạn cần phân biệt thêm. 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 thì quy tắc mới thêm khách truy cập vào danh sách. Đây được gọi là "dạng chuẩn tuyển" hoặc 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 chuẩn hội" hoặc AND_OF_ORS
và có sẵn cho expression_rule_user_list
bằng cách sử dụng trường rule_type
. Nếu bạn cố gắng sử dụng AND_OF_ORS
cho date_specific_rule_user_list
, thì sẽ xảy ra lỗi.
Bạn chỉ cần kết hợp các nhóm mục theo quy tắc ở trên thành 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 chúng ta 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);
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::V21::Common::FlexibleRuleUserListInfo->new({
inclusiveRuleOperator => AND,
inclusiveOperands => [
Google::Ads::GoogleAds::V21::Common::FlexibleRuleOperandInfo->new({
rule => Google::Ads::GoogleAds::V21::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 => []});
Thêm người dùng trước đây vào danh sách
Bạn cũng có thể thêm 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 quy trình điền sẵn không đồng bộ bằng cách định kỳ kiểm tra trạng thái của trường này.
Thao tác này sẽ chỉ thêm những 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.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-08-31 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-31 UTC."],[[["\u003cp\u003eGoogle Ads uses "disjunctive normal form" (OR of ANDs) by default, requiring every rule item in at least one rule item group to match for a visitor to be added to the list.\u003c/p\u003e\n"],["\u003cp\u003eYou can configure the list to use "conjunctive normal form" (AND of ORs) where at least one rule item in each rule item group must match, but this is not applicable to date-specific rule user lists.\u003c/p\u003e\n"],["\u003cp\u003ePast users (within the last 30 days) can be included in the list by setting the \u003ccode\u003eprepopulation_status\u003c/code\u003e to \u003ccode\u003eREQUESTED\u003c/code\u003e and monitoring its progress.\u003c/p\u003e\n"]]],[],null,["# Creating the User List\n\nFor [`expression_rule_user_list`](/google-ads/api/reference/rpc/v21/RuleBasedUserListInfo#expression_rule_user_list),\nthere's an additional distinction to make. By\ndefault, Google Ads will `AND` together all rule items in a rule item\ngroup. This means that **every rule item** in **at least one rule item group**\nmust match in order for the rule to add a visitor to the list. This is called\n\"disjunctive normal form\", or [`OR_OF_ANDS`](/google-ads/api/reference/rpc/v21/UserListRuleTypeEnum.UserListRuleType#or_of_ands).\n\nAlternatively, you could set up your list to only add a visitor to the list if\n**at least one rule item** in **each rule item group** matches. This\nis called \"conjunctive normal form\", or\n[`AND_OF_ORS`](/google-ads/api/reference/rpc/v21/UserListRuleTypeEnum.UserListRuleType#and_of_ors),\nand is available for [`expression_rule_user_list`](/google-ads/api/reference/rpc/v21/RuleBasedUserListInfo#expression_rule_user_list)\nby using the\n[`rule_type`](/google-ads/api/reference/rpc/v21/UserListRuleInfo#rule_type) field. Trying to\nuse `AND_OF_ORS` for a\n[`date_specific_rule_user_list`](/google-ads/api/reference/rpc/v21/RuleBasedUserListInfo#date_specific_rule_user_list)\nwill result in an error.\n\nAll that's left is to combine the rule item groups above into a new user\nlist. In this case, we'll leave the default `OR_OF_ANDS` functionality in place,\nsince that's what we built these rules for.\n\n\n### Java\n\n```java\nFlexibleRuleUserListInfo flexibleRuleUserListInfo =\n FlexibleRuleUserListInfo.newBuilder()\n .setInclusiveRuleOperator(UserListFlexibleRuleOperator.AND)\n .addInclusiveOperands(\n FlexibleRuleOperandInfo.newBuilder()\n .setRule(\n // The default rule_type for a UserListRuleInfo object is OR of ANDs\n // (disjunctive normal form). That is, rule items will be ANDed together\n // within rule item groups and the groups themselves will be ORed together.\n UserListRuleInfo.newBuilder()\n .addRuleItemGroups(checkoutDateRuleGroup)\n .addRuleItemGroups(checkoutAndCartSizeRuleGroup))\n // Optional: includes a lookback window for this rule, in days.\n .setLookbackWindowDays(7L))\n .build();https://github.com/googleads/google-ads-java/blob/3c3c1041c2a0ab81553e3b2a79876256649397ed/google-ads-examples/src/main/java/com/google/ads/googleads/examples/remarketing/SetUpAdvancedRemarketing.java#L196-L210\n \n```\n\n### C#\n\n```c#\nFlexibleRuleUserListInfo flexibleRuleUserListInfo = new FlexibleRuleUserListInfo();\nFlexibleRuleOperandInfo flexibleRuleOperandInfo = new FlexibleRuleOperandInfo() {\n Rule = new UserListRuleInfo()\n};\nflexibleRuleOperandInfo.Rule.RuleItemGroups.Add(checkoutAndCartSizeRuleGroup);\nflexibleRuleOperandInfo.Rule.RuleItemGroups.Add(checkoutDateRuleGroup);\nflexibleRuleUserListInfo.InclusiveOperands.Add(flexibleRuleOperandInfo);https://github.com/googleads/google-ads-dotnet/blob/ada966e1983b655e82172b6c3e7d9b091b522377/Google.Ads.GoogleAds/examples/Remarketing/SetUpAdvancedRemarketing.cs#L179-L185\n \n```\n\n### PHP\n\n```php\n$flexibleRuleUserListInfo = new FlexibleRuleUserListInfo([\n 'inclusive_rule_operator' =\u003e UserListFlexibleRuleOperator::PBAND,\n 'inclusive_operands' =\u003e [\n new FlexibleRuleOperandInfo([\n 'rule' =\u003e new UserListRuleInfo([\n // The default rule_type for a UserListRuleInfo object is OR of ANDs\n // (disjunctive normal form). That is, rule items will be ANDed together\n // within rule item groups and the groups themselves will be ORed together.\n 'rule_item_groups' =\u003e [\n $checkoutAndCartSizeRuleGroup,\n $checkoutDateRuleGroup\n ]\n ]),\n // Optionally add a lookback window for this rule, in days.\n 'lookback_window_days' =\u003e 7\n ])\n ],\n 'exclusive_operands' =\u003e []\n]); \nhttps://github.com/googleads/google-ads-php/blob/be0249c30c27b4760387bec6682b82c9f4167761/examples/Remarketing/SetUpAdvancedRemarketing.php#L198-L216\n\n \n```\n\n### Python\n\n```python\n# Create a FlexibleRuleUserListInfo object, or a flexible rule\n# representation of visitors with one or multiple actions.\n# FlexibleRuleUserListInfo wraps UserListRuleInfo in a\n# FlexibleRuleOperandInfo object that represents which user lists to\n# include or exclude.\nflexible_rule_user_list_info: FlexibleRuleUserListInfo = (\n rule_based_user_list_info.flexible_rule_user_list\n)\nflexible_rule_user_list_info.inclusive_rule_operator = (\n client.enums.UserListFlexibleRuleOperatorEnum.AND\n)\n# The default rule_type for a UserListRuleInfo object is OR of\n# ANDs (disjunctive normal form). That is, rule items will be\n# ANDed together within rule item groups and the groups\n# themselves will be ORed together.\nrule_operand: FlexibleRuleOperandInfo = client.get_type(\n \"FlexibleRuleOperandInfo\"\n)\nrule_operand.rule.rule_item_groups.extend(\n [\n checkout_and_cart_size_rule_group,\n checkout_date_rule_group,\n ]\n)\nrule_operand.lookback_window_days = 7\nflexible_rule_user_list_info.inclusive_operands.append(rule_operand)https://github.com/googleads/google-ads-python/blob/d0595698b8a7de6cc00684b467462601037c9db9/examples/remarketing/set_up_advanced_remarketing.py#L191-L216\n \n```\n\n### Ruby\n\n```ruby\nr.flexible_rule_user_list = client.resource.flexible_rule_user_list_info do |frul|\n frul.inclusive_rule_operator = :AND\n frul.inclusive_operands \u003c\u003c client.resource.flexible_rule_operand_info do |froi|\n froi.rule = client.resource.user_list_rule_info do |info|\n info.rule_item_groups += [checkout_date_rule_group, checkout_and_cart_size_rule_group]\n end\n # Optionally include a lookback window for this rule, in days.\n froi.lookback_window_days = 7\n end\nend \nhttps://github.com/googleads/google-ads-ruby/blob/2752563c7ffd15a4d2238116869f64aea3011cc3/examples/remarketing/set_up_advanced_remarketing.rb#L126-L135\n\n \n```\n\n### Perl\n\n```perl\nmy $flexible_rule_user_list_info =\n Google::Ads::GoogleAds::V21::Common::FlexibleRuleUserListInfo-\u003enew({\n inclusiveRuleOperator =\u003e AND,\n inclusiveOperands =\u003e [\n Google::Ads::GoogleAds::V21::Common::FlexibleRuleOperandInfo-\u003enew({\n rule =\u003e Google::Ads::GoogleAds::V21::Common::UserListRuleInfo-\u003enew({\n # The default rule_type for a UserListRuleInfo object is OR of\n # ANDs (disjunctive normal form). That is, rule items will be\n # ANDed together within rule item groups and the groups\n # themselves will be ORed together.\n ruleItemGroups =\u003e [\n $checkout_date_rule_group, $checkout_and_cart_size_rule_group\n ]}\n ),\n # Optionally include a lookback window for this rule, in days.\n lookback_window_days =\u003e 7\n })\n ],\n exclusiveOperands =\u003e []});https://github.com/googleads/google-ads-perl/blob/9abffd69cd856633dfdcee5c636fe9cd0eb4b5ed/examples/remarketing/set_up_advanced_remarketing.pl#L151-L169\n \n```\n\n\u003cbr /\u003e\n\nInclude past users in the list\n------------------------------\n\nYou can also include past users in a rule-based user list by setting the\n[`prepopulation_status`](/google-ads/api/reference/rpc/v21/RuleBasedUserListInfo#prepopulation_status)\nof the user list to\n[`REQUESTED`](/google-ads/api/reference/rpc/v21/UserListPrepopulationStatusEnum.UserListPrepopulationStatus#requested),\nand monitor the progress of the asynchronous prepopulation process by\nperiodically checking the status of this field.\n\nThis will only add past users from within the last 30 days, depending on the\nlist's membership duration and the date when the remarketing tag is added. The\nstatus will be updated to\n[`FINISHED`](/google-ads/api/reference/rpc/v21/UserListPrepopulationStatusEnum.UserListPrepopulationStatus#finished)\nonce the request is processed, or\n[`FAILED`](/google-ads/api/reference/rpc/v21/UserListPrepopulationStatusEnum.UserListPrepopulationStatus#failed)\nif the request fails."]]