การสร้างรายชื่อผู้ใช้
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
สำหรับ expression_rule_user_list
จะต้องแยกความแตกต่างเพิ่มเติม โดยค่าเริ่มต้น Google Ads จะAND
รายการกฎทั้งหมดในกลุ่มรายการกฎ
เข้าด้วยกัน ซึ่งหมายความว่ารายการกฎทุกรายการในกลุ่มรายการกฎอย่างน้อย 1 กลุ่ม
ต้องตรงกันเพื่อให้กฎเพิ่มผู้เข้าชมลงในรายการ ซึ่งเรียกว่า "รูปแบบปกติแบบแยก" หรือ OR_OF_ANDS
หรือคุณจะตั้งค่ารายการให้เพิ่มผู้เข้าชมลงในรายการเฉพาะในกรณีที่รายการกฎอย่างน้อย 1 รายการในกลุ่มรายการกฎแต่ละกลุ่มตรงกันก็ได้ ซึ่งเรียกว่า "รูปแบบปกติแบบร่วม" หรือ
AND_OF_ORS
และใช้ได้กับ expression_rule_user_list
โดยใช้ฟิลด์
rule_type
การพยายามใช้ 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: 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 => []});
รวมผู้ใช้ที่ผ่านมาไว้ในรายการ
นอกจากนี้ คุณยังรวมผู้ใช้ที่ผ่านมาไว้ในกลุ่มเป้าหมายตามกฎได้โดยตั้งค่า
prepopulation_status
ของกลุ่มเป้าหมายเป็น
REQUESTED
และตรวจสอบความคืบหน้าของกระบวนการเตรียมข้อมูลล่วงหน้าแบบไม่พร้อมกันโดย
ตรวจสอบสถานะของช่องนี้เป็นระยะๆ
การดำเนินการนี้จะเพิ่มเฉพาะผู้ใช้ที่ผ่านมาในช่วง 30 วันที่ผ่านมา โดยขึ้นอยู่กับ
ระยะเวลาการเป็นสมาชิกของรายการและวันที่เพิ่มแท็กรีมาร์เก็ตติ้ง
สถานะจะอัปเดตเป็น
FINISHED
เมื่อดำเนินการตามคำขอแล้ว หรือ
FAILED
หากคำขอไม่สำเร็จ
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-31 UTC
[null,null,["อัปเดตล่าสุด 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."]]