Create a user list

  • expression_rule_user_list defaults to "disjunctive normal form" (OR_OF_ANDS), where every rule item in at least one group must match.

  • "conjunctive normal form" (AND_OF_ORS) is available for expression_rule_user_list using the rule_type field, requiring at least one rule item in each group to match.

  • Attempting to use AND_OF_ORS with date_specific_rule_user_list will cause an error.

  • Past users can be included in a rule-based user list by setting prepopulation_status to REQUESTED, which includes users from the last 30 days depending on list settings and tag date.

  • The prepopulation status can be monitored and will change to FINISHED or FAILED.

You can use user lists in your remarketing campaigns to re-engage with users who have performed specific actions on your website or app. The Google Ads API supports several types of user lists. This guide focuses on creating rule-based user lists.

Rule-based user lists

Rule-based user lists built with flexible_rule_user_list can contain multiple rules. Each rule is represented by a UserListRuleInfo message, which has a rule_type that dictates how rule items within rule item groups are combined.

If rule_type is OR_OF_ANDS (the default), Google Ads will AND together all rule items in a rule item group. This means that for a given rule, every rule item in at least one rule item group must match for the rule to be satisfied. This is called "disjunctive normal form."

Alternatively, if you set rule_type to AND_OF_ORS, then at least one rule item in each rule item group must match for the rule to be satisfied. This is called "conjunctive normal form."

All that's left is to combine the rule item groups above into a new user list. In this case, we'll leave the default OR_OF_ANDS functionality in place, since that's what we built these rules for.

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

Include past users in a rule-based list

You can also include past users in a rule-based user list by setting the prepopulation_status of the user list to REQUESTED, and monitor the progress of the asynchronous prepopulation process by periodically checking the status of this field.

This will only add past users from within the last 30 days, depending on the list's membership duration and the date when the remarketing tag is added. The status will be updated to FINISHED once the request is processed, or FAILED if the request fails.