নিয়ম আইটেম গ্রুপ তৈরি করা

এই উদাহরণটি দুটি নিয়ম আইটেম গ্রুপ তৈরি করে।

প্রথম নিয়ম_আইটেম_গ্রুপ তৈরি করুন

প্রথম rule_item_group তৈরি করে শুরু করুন যা দুটি rule_item ক্ষেত্র বা UserListRuleItemInfo অবজেক্ট নিয়ে গঠিত:

  1. ব্যবহারকারীরা যারা চেকআউট পৃষ্ঠা পরিদর্শন করেছেন৷
  2. তাদের শপিং কার্টে একাধিক আইটেম সহ ব্যবহারকারীরা।

প্রথম নিয়ম আইটেমটি ecomm_pagetype প্যারামিটার ব্যবহার করে যার স্ট্রিং মান রয়েছে, তাই আপনাকে প্রথমে একটি string_rule_item তৈরি করতে হবে।

জাভা

UserListRuleItemInfo checkoutRule =
    UserListRuleItemInfo.newBuilder()
        // The rule variable name must match a corresponding key name fired from a pixel.
        // To learn more about setting up remarketing tags, visit
        // https://support.google.com/google-ads/answer/2476688.
        // To learn more about remarketing events and parameters, visit
        // https://support.google.com/google-ads/answer/7305793.
        .setName("ecomm_pagetype")
        .setStringRuleItem(
            UserListStringRuleItemInfo.newBuilder()
                .setOperator(UserListStringRuleItemOperator.EQUALS)
                .setValue("checkout")
                .build())
        .build();
      

সি#

UserListRuleItemInfo checkoutRule = new UserListRuleItemInfo
{
    // The rule variable name must match a corresponding key name fired from a pixel.
    // To learn more about setting up remarketing tags, visit
    // https://support.google.com/google-ads/answer/2476688.
    // To learn more about remarketing events and parameters, visit
    // https://support.google.com/google-ads/answer/7305793.
    Name = "ecomm_pagetype",
    StringRuleItem = new UserListStringRuleItemInfo
    {
        Operator = UserListStringRuleItemOperator.Equals,
        Value = "checkout"
    }
};
      

পিএইচপি

$checkoutRule = new UserListRuleItemInfo([
    // The rule variable name must match a corresponding key name fired from a pixel.
    // To learn more about setting up remarketing tags, visit
    // https://support.google.com/google-ads/answer/2476688.
    // To learn more about remarketing events and parameters, visit
    // https://support.google.com/google-ads/answer/7305793.
    'name' => 'ecomm_pagetype',
    'string_rule_item' => new UserListStringRuleItemInfo([
        'operator' => UserListStringRuleItemOperator::EQUALS,
        'value' => 'checkout'
    ])
]);
      

পাইথন

checkout_rule = client.get_type("UserListRuleItemInfo")

# The rule variable name must match a corresponding key name fired from a
# pixel. To learn more about setting up remarketing tags, visit:
# https://support.google.com/google-ads/answer/2476688.
#
# To learn more about remarketing events and parameters, visit:
# https://support.google.com/google-ads/answer/7305793.
checkout_rule.name = "ecomm_pagetype"
checkout_string_rule_item = checkout_rule.string_rule_item
checkout_string_rule_item.operator = (
    client.enums.UserListStringRuleItemOperatorEnum.EQUALS
)
checkout_string_rule_item.value = "checkout"
      

রুবি

checkout_rule = client.resource.user_list_rule_item_info do |rule|
  # The rule variable name must match a corresponding key name fired
  # from a pixel.
  # To learn more about setting up remarketing tags, visit
  # https://support.google.com/google-ads/answer/2476688.
  # To learn more about remarketing events and parameters, visit
  # https://support.google.com/google-ads/answer/7305793.
  rule.name = "ecomm_pagetype"
  rule.string_rule_item = client.resource.user_list_string_rule_item_info do |sr|
    sr.operator = :EQUALS
    sr.value = "checkout"
  end
end
      

পার্ল

my $checkout_rule =
  Google::Ads::GoogleAds::V17::Common::UserListRuleItemInfo->new({
    # The rule variable name must match a corresponding key name fired from a
    # pixel. To learn more about setting up remarketing tags, visit
    # https://support.google.com/google-ads/answer/2476688.
    # To learn more about remarketing events and parameters, visit
    # https://support.google.com/google-ads/answer/7305793.
    name           => "ecomm_pagetype",
    stringRuleItem =>
      Google::Ads::GoogleAds::V17::Common::UserListStringRuleItemInfo->new({
        operator => EQUALS,
        value    => "checkout"
      })});
      

দ্বিতীয় নিয়ম আইটেমটি cartsize প্যারামিটার ব্যবহার করে যার সংখ্যাসূচক মান রয়েছে, তাই এখন আপনার একটি number_rule_item প্রয়োজন হবে।

জাভা

UserListRuleItemInfo cartSizeRule =
    UserListRuleItemInfo.newBuilder()
        // The rule variable name must match a corresponding key name fired from a pixel.
        .setName("cart_size")
        .setNumberRuleItem(
            UserListNumberRuleItemInfo.newBuilder()
                .setOperator(UserListNumberRuleItemOperator.GREATER_THAN)
                .setValue(1.0)
                .build())
        .build();
      

সি#

UserListRuleItemInfo cartSizeRule = new UserListRuleItemInfo
{
    // The rule variable name must match a corresponding key name fired from a pixel.
    Name = "cart_size",
    NumberRuleItem = new UserListNumberRuleItemInfo
    {
        Operator = UserListNumberRuleItemOperator.GreaterThan,
        Value = 1.0
    }
};
      

পিএইচপি

$cartSizeRule = new UserListRuleItemInfo([
    // The rule variable name must match a corresponding key name fired from a pixel.
    'name' => 'cart_size',
    'number_rule_item' => new UserListNumberRuleItemInfo([
        'operator' => UserListNumberRuleItemOperator::GREATER_THAN,
        'value' => 1.0
    ])
]);
      

পাইথন

cart_size_rule = client.get_type("UserListRuleItemInfo")
# The rule variable name must match a corresponding key name fired from a
# pixel.
cart_size_rule.name = "cart_size"
cart_size_number_rule_item = cart_size_rule.number_rule_item
cart_size_number_rule_item.operator = (
    client.enums.UserListNumberRuleItemOperatorEnum.GREATER_THAN
)
cart_size_number_rule_item.value = 1.0
      

রুবি

cart_size_rule = client.resource.user_list_rule_item_info do |rule|
  # The rule variable name must match a corresponding key name fired
  # from a pixel.
  rule.name = "cart_size"
  rule.number_rule_item = client.resource.user_list_number_rule_item_info do |nr|
    nr.operator = :GREATER_THAN
    nr.value = 1.0
  end
end
      

পার্ল

my $cart_size_rule =
  Google::Ads::GoogleAds::V17::Common::UserListRuleItemInfo->new({
    # The rule variable name must match a corresponding key name fired from a
    # pixel.
    name           => "cart_size",
    numberRuleItem =>
      Google::Ads::GoogleAds::V17::Common::UserListNumberRuleItemInfo->new({
        # Available UserListNumberRuleItemOperators can be found at
        # https://developers.google.com/google-ads/api/reference/rpc/latest/UserListNumberRuleItemOperatorEnum.UserListNumberRuleItemOperator
        operator => GREATER_THAN,
        value    => 1.0
      })});
      

এরপরে, একটি UserListRuleItemGroupInfo অবজেক্টে দুটি নিয়ম আইটেম একত্রিত করুন। ডিফল্টরূপে, যখন আইটেমগুলিকে একটি আইটেম গ্রুপে একত্রিত করা হয়, তখন Google বিজ্ঞাপনগুলি AND তাদের নিয়মগুলি একসাথে করবে৷ ব্যবহারকারীর তালিকা তৈরি করা আরও বিশদ রয়েছে।

জাভা

UserListRuleItemGroupInfo checkoutAndCartSizeRuleGroup =
    UserListRuleItemGroupInfo.newBuilder()
        .addAllRuleItems(ImmutableList.of(checkoutRule, cartSizeRule))
        .build();
      

সি#

UserListRuleItemGroupInfo checkoutAndCartSizeRuleGroup =
    new UserListRuleItemGroupInfo();
checkoutAndCartSizeRuleGroup.RuleItems.Add(checkoutRule);
checkoutAndCartSizeRuleGroup.RuleItems.Add(cartSizeRule);
      

পিএইচপি

$checkoutAndCartSizeRuleGroup = new UserListRuleItemGroupInfo([
    'rule_items' => [$checkoutRule, $cartSizeRule]
]);
      

পাইথন

checkout_and_cart_size_rule_group.rule_items.extend(
    [
        checkout_rule,
        cart_size_rule,
    ]
)
      

রুবি

  checkout_and_cart_size_rule_group = client.resource.user_list_rule_item_group_info do |g|
    g.rule_items += [checkout_rule, cart_size_rule]
  end

  # Create the RuleItem for checkout start date.
  # The tags and keys used below must have been in place in the past for the
  # date range specified in the rules.
  start_date_rule = client.resource.user_list_rule_item_info do |rule|
    # The rule variable name must match a corresponding key name fired
    # from a pixel.
    rule.name = "checkoutdate"
    rule.date_rule_item = client.resource.user_list_date_rule_item_info do |dr|
      dr.operator = :AFTER
      dr.value = "20191031"
    end
  end

  # Create the RuleItem for checkout end date.
  end_date_rule = client.resource.user_list_rule_item_info do |rule|
    # The rule variable name must match a corresponding key name fired
    # from a pixel.
    rule.name = "checkoutdate"
    rule.date_rule_item = client.resource.user_list_date_rule_item_info do |dr|
      dr.operator = :BEFORE
      dr.value = "20200101"
    end
  end

  # Creates a rule group targeting users who checked out between
  # November and December by using the start and end date rules.
  # Combining the two rule items into a user_list_rule_item_group_info
  # object causes Google Ads to AND their rules together.
  # To instead OR the rules together, each rule should be placed in its
  # own rule item group.
  checkout_date_rule_group = client.resource.user_list_rule_item_group_info do |g|
    g.rule_items += [start_date_rule, end_date_rule]
  end

  # Creates the user list operation.
  operation = client.operation.create_resource.user_list do |ul|
    ul.name = "My expression rule user list ##{(Time.new.to_f * 1000).to_i}"
    ul.description = "Users who checked out in November or December OR visited " \
      "the checkout page with more than one item in their cart"
    ul.membership_status = :OPEN
    ul.membership_life_span = 90
    ul.rule_based_user_list = client.resource.rule_based_user_list_info do |r|
      # Optional: To include past users in the user list, set the
      # prepopulation_status to REQUESTED.
      r.prepopulation_status = :REQUESTED
      # Create a flexible_rule_user_list 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.
      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
    end
  end

  # Issues a muate request to create the user list.
  response = client.service.user_list.mutate_user_lists(
    customer_id: customer_id,
    operations: [operation],
  )
  puts "Created user list with resource name '#{response.results.first.resource_name}'"
end

if __FILE__ == $0
  PAGE_SIZE = 1000

  options = {}

  # Running the example with -h will print the command line usage.
  OptionParser.new do |opts|
    opts.banner = sprintf('Usage: %s [options]', File.basename(__FILE__))

    opts.separator ''
    opts.separator 'Options:'

    opts.on('-C', '--customer-id CUSTOMER-ID', String, 'Customer ID') do |v|
      options[:customer_id] = v
    end

    opts.separator ''
    opts.separator 'Help:'

    opts.on_tail('-h', '--help', 'Show this message') do
      puts opts
      exit
    end
  end.parse!

  begin
    set_up_advanced_remarketing(options.fetch(:customer_id).tr("-", ""))
  rescue Google::Ads::GoogleAds::Errors::GoogleAdsError => e
    e.failure.errors.each do |error|
      STDERR.printf("Error with message: %s\n", error.message)
      if error.location
        error.location.field_path_elements.each do |field_path_element|
          STDERR.printf("\tOn field: %s\n", field_path_element.field_name)
        end
      end
      error.error_code.to_h.each do |k, v|
        next if v == :UNSPECIFIED
        STDERR.printf("\tType: %s\n\tCode: %s\n", k, v)
      end
    end
    raise
  end
end

      

পার্ল

my $checkout_and_cart_size_rule_group =
  Google::Ads::GoogleAds::V17::Common::UserListRuleItemGroupInfo->new(
  {ruleItems => [$checkout_rule, $cart_size_rule]});
      

দ্বিতীয় নিয়ম_আইটেম_গ্রুপ তৈরি করুন

দ্বিতীয় rule_item_group দুটি rule_item ক্ষেত্র বা UserListRuleItemInfo অবজেক্ট রয়েছে:

  1. যে ব্যবহারকারীরা 31শে অক্টোবরের পরে চেক আউট করেছেন৷
  2. যে ব্যবহারকারীরা ১লা জানুয়ারির আগে চেক আউট করেছেন।

এই নিয়ম আইটেম দুটিই checkoutdate প্যারামিটার ব্যবহার করে যার তারিখের মান রয়েছে, তাই এইবার আপনি UserListDateRuleItemInfo অবজেক্টের সাথে date_rule_item ক্ষেত্রগুলি পূরণ করবেন।

প্রথমে শুরুর তারিখ:

জাভা

UserListRuleItemInfo startDateRule =
    UserListRuleItemInfo.newBuilder()
        // The rule variable name must match a corresponding key name fired from a pixel.
        .setName("checkoutdate")
        .setDateRuleItem(
            UserListDateRuleItemInfo.newBuilder()
                // Available UserListDateRuleItemOperators can be found at
                // https://developers.google.com/google-ads/api/reference/rpc/latest/UserListDateRuleItemOperatorEnum.UserListDateRuleItemOperator
                .setOperator(UserListDateRuleItemOperator.AFTER)
                .setValue("20191031")
                .build())
        .build();
      

সি#

UserListRuleItemInfo startDateRule = new UserListRuleItemInfo
{
    // The rule variable name must match a corresponding key name fired from a pixel.
    Name = "checkoutdate",
    DateRuleItem = new UserListDateRuleItemInfo
    {
        // Available UserListDateRuleItemOperators can be found at
        // https://developers.google.com/google-ads/api/reference/rpc/latest/UserListDateRuleItemOperatorEnum.UserListDateRuleItemOperator
        Operator = UserListDateRuleItemOperator.After,
        Value = "20191031"
    }
};
      

পিএইচপি

$startDateRule = new UserListRuleItemInfo([
    // The rule variable name must match a corresponding key name fired from a pixel.
    'name' => 'checkoutdate',
    'date_rule_item' => new UserListDateRuleItemInfo([
        // Available UserListDateRuleItemOperators can be found at
        // https://developers.google.com/google-ads/api/reference/rpc/latest/UserListDateRuleItemOperatorEnum.UserListDateRuleItemOperator
        'operator' => UserListDateRuleItemOperator::AFTER,
        'value' => '20191031'
    ])
]);
      

পাইথন

start_date_rule = client.get_type("UserListRuleItemInfo")
start_date_rule.name = "checkoutdate"
start_date_rule_item = start_date_rule.date_rule_item
# Available UserListDateRuleItemOperators can be found at:
# https://developers.google.com/google-ads/api/reference/rpc/latest/UserListDateRuleItemOperatorEnum.UserListDateRuleItemOperator
user_list_data_rule_item_operator_enum = (
    client.enums.UserListDateRuleItemOperatorEnum
)
start_date_rule_item.operator = user_list_data_rule_item_operator_enum.AFTER
start_date_rule_item.value = "20191031"
      

রুবি

start_date_rule = client.resource.user_list_rule_item_info do |rule|
  # The rule variable name must match a corresponding key name fired
  # from a pixel.
  rule.name = "checkoutdate"
  rule.date_rule_item = client.resource.user_list_date_rule_item_info do |dr|
    dr.operator = :AFTER
    dr.value = "20191031"
  end
end
      

পার্ল

my $start_date_rule =
  Google::Ads::GoogleAds::V17::Common::UserListRuleItemInfo->new({
    # The rule variable name must match a corresponding key name fired from a
    # pixel.
    name         => "checkoutdate",
    dateRuleItem =>
      Google::Ads::GoogleAds::V17::Common::UserListDateRuleItemInfo->new({
        # Available UserListDateRuleItemOperators can be found at
        # https://developers.google.com/google-ads/api/reference/rpc/latest/UserListDateRuleItemOperatorEnum.UserListDateRuleItemOperator
        operator => AFTER,
        value    => "20191031"
      })});
      

তারপর, শেষ তারিখ:

জাভা

UserListRuleItemInfo endDateRule =
    UserListRuleItemInfo.newBuilder()
        // The rule variable name must match a corresponding key name fired from a pixel.
        .setName("checkoutdate")
        .setDateRuleItem(
            UserListDateRuleItemInfo.newBuilder()
                .setOperator(UserListDateRuleItemOperator.BEFORE)
                .setValue("20200101")
                .build())
        .build();
      

সি#

UserListRuleItemInfo endDateRule = new UserListRuleItemInfo
{
    // The rule variable name must match a corresponding key name fired from a pixel.
    Name = "checkoutdate",
    DateRuleItem = new UserListDateRuleItemInfo
    {
        Operator = UserListDateRuleItemOperator.Before,
        Value = "20200101"
    }
};
      

পিএইচপি

$endDateRule = new UserListRuleItemInfo([
    // The rule variable name must match a corresponding key name fired from a pixel.
    'name' => 'checkoutdate',
    'date_rule_item' => new UserListDateRuleItemInfo([
        'operator' => UserListDateRuleItemOperator::BEFORE,
        'value' => '20200101'
    ])
]);
      

পাইথন

end_date_rule = client.get_type("UserListRuleItemInfo")
end_date_rule.name = "checkoutdate"
end_date_rule_item = end_date_rule.date_rule_item
end_date_rule_item.operator = user_list_data_rule_item_operator_enum.BEFORE
end_date_rule_item.value = "20200101"
      

রুবি

end_date_rule = client.resource.user_list_rule_item_info do |rule|
  # The rule variable name must match a corresponding key name fired
  # from a pixel.
  rule.name = "checkoutdate"
  rule.date_rule_item = client.resource.user_list_date_rule_item_info do |dr|
    dr.operator = :BEFORE
    dr.value = "20200101"
  end
end
      

পার্ল

my $end_date_rule =
  Google::Ads::GoogleAds::V17::Common::UserListRuleItemInfo->new({
    # The rule variable name must match a corresponding key name fired from a
    # pixel.
    name         => "checkoutdate",
    dateRuleItem =>
      Google::Ads::GoogleAds::V17::Common::UserListDateRuleItemInfo->new({
        operator => BEFORE,
        value    => "20200101"
      })});
      

প্রথম নিয়ম আইটেম গোষ্ঠীর মতো, এই দুটি rule_item ক্ষেত্রগুলিকে একটি UserListRuleItemGroupInfo অবজেক্টে AND এ একত্রিত করুন।

জাভা

UserListRuleItemGroupInfo checkoutDateRuleGroup =
    UserListRuleItemGroupInfo.newBuilder()
        .addAllRuleItems(ImmutableList.of(startDateRule, endDateRule))
        .build();
      

সি#

UserListRuleItemGroupInfo checkoutDateRuleGroup = new UserListRuleItemGroupInfo();
checkoutDateRuleGroup.RuleItems.Add(startDateRule);
checkoutDateRuleGroup.RuleItems.Add(endDateRule);
      

পিএইচপি

$checkoutDateRuleGroup = new UserListRuleItemGroupInfo([
    'rule_items' => [$startDateRule, $endDateRule]
]);
      

পাইথন

checkout_date_rule_group.rule_items.extend(
    [
        start_date_rule,
        end_date_rule,
    ]
)
      

রুবি

checkout_date_rule_group = client.resource.user_list_rule_item_group_info do |g|
  g.rule_items += [start_date_rule, end_date_rule]
end
      

পার্ল

my $checkout_date_rule_group =
  Google::Ads::GoogleAds::V17::Common::UserListRuleItemGroupInfo->new(
  {ruleItems => [$start_date_rule, $end_date_rule]});