Create the first rule_item_group
Start by creating the first rule_item_group
which consists of
two rule_item
fields, or UserListRuleItemInfo
objects:
- Users who visited the checkout page.
- Users with more than one item in their shopping cart.
The first rule item uses the ecomm_pagetype
parameter which has string values,
so you must create a string_rule_item
first.
Java
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();
C#
This example is not yet available in C#; you can take a look at the other languages.
PHP
$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' ]) ]);
Python
This example is not yet available in Python; you can take a look at the other languages.
Ruby
This example is not yet available in Ruby; you can take a look at the other languages.
Perl
my $checkout_rule = Google::Ads::GoogleAds::V6::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::V6::Common::UserListStringRuleItemInfo->new({ operator => EQUALS, value => "checkout" })});
The second rule item uses the cartsize
parameter which has numeric values, so
now you'll need a number_rule_item
.
Java
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();
C#
This example is not yet available in C#; you can take a look at the other languages.
PHP
$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 ]) ]);
Python
This example is not yet available in Python; you can take a look at the other languages.
Ruby
This example is not yet available in Ruby; you can take a look at the other languages.
Perl
my $cart_size_rule = Google::Ads::GoogleAds::V6::Common::UserListRuleItemInfo->new({ # The rule variable name must match a corresponding key name fired from a # pixel. name => "cart_size", numberRuleItem => Google::Ads::GoogleAds::V6::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 })});
Next, combine the two rule items into a
UserListRuleItemGroupInfo
object. By
default, when items are combined into an item group, Google Ads will AND
their
rules together. Creating the User
List has more details.
Java
UserListRuleItemGroupInfo checkoutAndCartSizeRuleGroup = UserListRuleItemGroupInfo.newBuilder() .addAllRuleItems(ImmutableList.of(checkoutRule, cartSizeRule)) .build();
C#
This example is not yet available in C#; you can take a look at the other languages.
PHP
$checkoutAndCartSizeRuleGroup = new UserListRuleItemGroupInfo([ 'rule_items' => [$checkoutRule, $cartSizeRule] ]);
Python
This example is not yet available in Python; you can take a look at the other languages.
Ruby
This example is not yet available in Ruby; you can take a look at the other languages.
Perl
my $checkout_and_cart_size_rule_group = Google::Ads::GoogleAds::V6::Common::UserListRuleItemGroupInfo->new( {ruleItems => [$checkout_rule, $cart_size_rule]});
Create the second rule_item_group
The second rule_item_group
also consists of two rule_item
fields, or
UserListRuleItemInfo
objects:
- Users who checked out after October 31st.
- Users who checked out before January 1st.
Both of these rule items use the checkoutdate
parameter which has date values,
so this time you'll populate the date_rule_item
fields with
UserListDateRuleItemInfo
objects.
First the start date:
Java
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();
C#
This example is not yet available in C#; you can take a look at the other languages.
PHP
$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' ]) ]);
Python
This example is not yet available in Python; you can take a look at the other languages.
Ruby
This example is not yet available in Ruby; you can take a look at the other languages.
Perl
my $start_date_rule = Google::Ads::GoogleAds::V6::Common::UserListRuleItemInfo->new({ # The rule variable name must match a corresponding key name fired from a # pixel. name => "checkoutdate", dateRuleItem => Google::Ads::GoogleAds::V6::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" })});
Then, the end date:
Java
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();
C#
This example is not yet available in C#; you can take a look at the other languages.
PHP
$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' ]) ]);
Python
This example is not yet available in Python; you can take a look at the other languages.
Ruby
This example is not yet available in Ruby; you can take a look at the other languages.
Perl
my $end_date_rule = Google::Ads::GoogleAds::V6::Common::UserListRuleItemInfo->new({ # The rule variable name must match a corresponding key name fired from a # pixel. name => "checkoutdate", dateRuleItem => Google::Ads::GoogleAds::V6::Common::UserListDateRuleItemInfo->new({ operator => BEFORE, value => "20200101" })});
As with the first rule item group, combine these two rule_item
fields into a
UserListRuleItemGroupInfo
object to AND
them together.
Java
UserListRuleItemGroupInfo checkoutDateRuleGroup = UserListRuleItemGroupInfo.newBuilder() .addAllRuleItems(ImmutableList.of(startDateRule, endDateRule)) .build();
C#
This example is not yet available in C#; you can take a look at the other languages.
PHP
$checkoutDateRuleGroup = new UserListRuleItemGroupInfo([ 'rule_items' => [$startDateRule, $endDateRule] ]);
Python
This example is not yet available in Python; you can take a look at the other languages.
Ruby
This example is not yet available in Ruby; you can take a look at the other languages.
Perl
my $checkout_date_rule_group = Google::Ads::GoogleAds::V6::Common::UserListRuleItemGroupInfo->new( {ruleItems => [$start_date_rule, $end_date_rule]});