Creazione dell'elenco utenti

Per expression_rule_user_list, devi fare un'altra distinzione. Per impostazione predefinita, Google Ads AND insieme tutti gli elementi delle regole in un gruppo di elementi della regola. Ciò significa che ogni elemento della regola in almeno un gruppo di elementi della regola deve corrispondere affinché la regola aggiunga un visitatore all'elenco. Questa è chiamata "forma normale disgiuntiva" o OR_OF_ANDS.

In alternativa, puoi configurare l'elenco in modo da aggiungere un visitatore all'elenco solo se almeno un elemento della regola in ogni gruppo di elementi della regola corrisponde. Questo è chiamato "forma normale congiuntiva" o AND_OF_ORS ed è disponibile per expression_rule_user_list utilizzando il campo rule_type. Se provi a utilizzare AND_OF_ORS per date_specific_rule_user_list si verificherà un errore.

Non ti resta che combinare i gruppi di elementi delle regole indicati sopra in un nuovo elenco di utenti. In questo caso, lasceremo attiva la funzionalità OR_OF_ANDS predefinita, perché è per questo che abbiamo creato queste regole.

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

Limita per intervallo di date della visita al sito

Il expression_rule_user_list precedente soddisfa le tue esigenze, ma cosa succede se vuoi solo acquisire gli utenti che soddisfano la regola nell'elenco e visitano il tuo sito tra il 1° ottobre e il 31 dicembre? Utilizza date_specific_rule_user_list.

La creazione di un date_specific_rule_user_list segue la stessa procedura che seguiresti per un expression_rule_user_list. Anziché impostare il campo expression_rule_user_list dell'oggetto RuleBasedUserListInfo, imposta il campo date_specific_rule_user_list con un oggetto DateSpecificRuleUserListInfo. Questo oggetto conterrà i campi per start_date e end_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();

Il nuovo elenco conterrà tutti gli utenti che soddisfano le stesse regole dell'elenco precedente, ma solo se visitano il tuo sito tra il giorno start_date (incluso) e end_date (incluso).

Includi utenti precedenti nell'elenco

Puoi anche includere gli utenti precedenti in un elenco di utenti basato su regole impostando il valore prepopulation_status dell'elenco utenti su REQUESTED e monitorare l'avanzamento del processo di precompilazione asincrono controllando periodicamente lo stato di questo campo.

In questo modo vengono aggiunti solo gli utenti passati degli ultimi 30 giorni, a seconda della durata inclusione dell'elenco e della data in cui è stato aggiunto il tag di remarketing. Lo stato verrà aggiornato a FINISHED una volta elaborata la richiesta o a FAILED se la richiesta non va a buon fine.