Get rules of a REMARKETING UserList

161 views
Skip to first unread message

kondiment test

unread,
Sep 21, 2016, 4:44:08 AM9/21/16
to AdWords API Forum
Hi there!

How can I get the rules with which a UserList was created? I have created a remarketing list with rules, in the AdWords web interface and I'm pulling it through the API using AdwordsUserListService->get(), but I don't know how to get its rules.

Thank you!

Peter Oliquino

unread,
Sep 21, 2016, 5:30:44 AM9/21/16
to AdWords API Forum
Hi,

You will need to specify the correct UserList type whether it is DateSpecificRuleUserList or ExpressionRuleUserList and get the details through their respective rule (DateSpecificRuleUserList.rule or ExpressionRuleUserList.rule) fields. You may also refer to this page for additional information regarding other selectable fields using the AdWordsUserListService. Let me know if this helps. 

Best regards,
Peter
AdWords API Team

kondiment test

unread,
Sep 21, 2016, 9:43:46 AM9/21/16
to AdWords API Forum
Thank you, Peter!

What do you mean by "You will need to specify the correct UserList type"? In my call I selected both `DateSpecificListRule` and `ExpressionListRule` but no fields with rules appeared in the response. The 2 remarketing lists that I get are

object(UserList)[361]
      public 'id' => string '411918617' (length=9)
      public 'isReadOnly' => boolean true
      public 'name' => string 'All visitors' (length=12)
      public 'description' => string 'People who visited pages that contain your remarketing tags' (length=59)
      public 'status' => string 'OPEN' (length=4)
      public 'integrationCode' => null
      public 'accessReason' => string 'OWNED' (length=5)
      public 'accountUserListStatus' => string 'ACTIVE' (length=6)
      public 'membershipLifeSpan' => int 30
      public 'size' => int 0
      public 'sizeRange' => string 'LESS_THAN_FIVE_HUNDRED' (length=22)
      public 'sizeForSearch' => int 0
      public 'sizeRangeForSearch' => string 'LESS_THAN_FIVE_HUNDRED' (length=22)
      public 'listType' => null
      public 'isEligibleForSearch' => boolean true
      public 'isEligibleForDisplay' => boolean true
      public 'UserListType' => string 'UserList' (length=8)
      private '_parameterMap' => 
        array (size=1)
          'UserList.Type' => string 'UserListType' (length=12)

and

object(UserList)[358]
      public 'id' => string '414687168' (length=9)
      public 'isReadOnly' => boolean false
      public 'name' => string 'My remarketing list with rules [ADW-made]' (length=41)
      public 'description' => string '' (length=0)
      public 'status' => string 'OPEN' (length=4)
      public 'integrationCode' => null
      public 'accessReason' => string 'OWNED' (length=5)
      public 'accountUserListStatus' => string 'ACTIVE' (length=6)
      public 'membershipLifeSpan' => int 30
      public 'size' => int 0
      public 'sizeRange' => string 'LESS_THAN_FIVE_HUNDRED' (length=22)
      public 'sizeForSearch' => int 0
      public 'sizeRangeForSearch' => string 'LESS_THAN_FIVE_HUNDRED' (length=22)
      public 'listType' => null
      public 'isEligibleForSearch' => boolean false
      public 'isEligibleForDisplay' => boolean true
      public 'UserListType' => string 'UserList' (length=8)
      private '_parameterMap' => 
        array (size=1)
          'UserList.Type' => string 'UserListType' (length=12)

The fact that I don't get a list type in the `listType` field, I consider it a bug: https://groups.google.com/forum/#!topic/adwords-api/T8Q9pi2671w

I use the AdWordsUserListService->get() and the selector is

$selector = new \Selector;
$selector->fields = array('Id', 'Name', 'Description', 'Status', 'IsReadOnly', 'AccessReason', 'AccountUserListStatus', 'MembershipLifeSpan', 'Size', 'SizeRange', 'SizeForSearch', 'SizeRangeForSearch', 'ListType', 'IsEligibleForSearch', 'IsEligibleForDisplay', 'SeedUserListId', 'SeedUserListName', 'SeedUserListDescription', 'SeedUserListStatus', 'SeedListSize', 'DateSpecificListRule', 'ExpressionListRule', 'DateSpecificListEndDate', 'DateSpecificListStartDate');

Thank you.

Peter Oliquino

unread,
Sep 22, 2016, 1:36:34 AM9/22/16
to AdWords API Forum
Hi,

Apologies for the delayed response. I am not exactly sure why you are not getting a value for the listType field since I am able to retrieve it using the AdwordsUserListService.get. Could you confirm if you referred to our example in creating your RuleBasedUserLists?

My apologies as well as I am not very familiar with PHP code, however, I was able to get some of the details of the UserLists using my code in Java as seen below :

 SelectorBuilder builder = new SelectorBuilder();
 Selector selector = builder
     .fields(AdwordsUserListField.Id, AdwordsUserListField.ListType, AdwordsUserListField.Rules)
     .offset(offset)
     .limit(PAGE_SIZE)
     .build();
 
 while (morePages) {
   
   UserListPage userListPage = userListService.get(selector);
   
   if (userListPage.getEntries() != null && userListPage.getEntries().length > 0) {
     for (UserList adwordsUserList : userListPage.getEntries()) {
       
       //Get the list type
       String listType = adwordsUserList.getListType().toString();
       
       //Apply condition based on list type
       if (("RULE_BASED").equals(listType)){
         
         //Since there are two types of RuleBasedUserList we get the UsetListType
         String userListType = adwordsUserList.getUserListType();
         String rule = "";
         String id = "";
         String name = "";
         
         //Get the details
         if (("ExpressionRuleUserList").equals(userListType)) {
           ExpressionRuleUserList expRuleUserList = (ExpressionRuleUserList) adwordsUserList;
           id = expRuleUserList.getId().toString();
           name = expRuleUserList.getName().toString();
           rule =  expRuleUserList.getRule().getGroups()[0].getItems()[0].getStringRuleItem().getValue();
           
         } else if (("DateSpecificRuleUserList").equals(userListType)) {
           DateSpecificRuleUserList dateRuleUserList = (DateSpecificRuleUserList) adwordsUserList;
           id = dateRuleUserList.getId().toString();
           name = dateRuleUserList.getName().toString();
           rule = dateRuleUserList.getRule().getGroups()[0].getItems()[0].getStringRuleItem().getValue();
         }
         //Output
         System.out.printf("Rule based user list with id = '%s' , name = '%s' and rule = '%s' was found.%n", id, name, rule);
         
       } else {
         //Apply condition for other list types
         System.out.println("Not rule based user list");
       }
     }
   } else {
     System.out.println("No rule based user lists found.");
   }
   
   offset += PAGE_SIZE;
   selector = builder.increaseOffsetBy(PAGE_SIZE).build();
   morePages = offset < userListPage.getTotalNumEntries();
   
 }

The output that was generated is as seen below :

Not rule based
Not rule based
Not rule based
Not rule based
Rule based user list with id = 'XXXXXXXX' , name = 'Expression based user list created at 20160922_105707' and rule = 'checkout' was found.
Rule based user list with id = 'XXXXXXXX' , name = 'Date rule user list created at 20160922_105707' and rule = 'checkout' was found.


I hope this helps and if you are still not able to get the information that you need, kindly provide your customer ID and any SOAP request and response so I can further investigate the issue. Please reply using Reply privately to author in doing so.

kondiment test

unread,
Sep 22, 2016, 9:09:34 AM9/22/16
to AdWords API Forum
Hi Peter,

I have privately sent you the requested information.

I would like to add that for user lists created through the API, the listType field is populated with the value 'RULE_BASED'. So this means that only when the list was created in the AdWords web interface the listType field is null. This is what Yin Niu was saying in https://groups.google.com/forum/#!topic/adwords-api/T8Q9pi2671w, but I consider this to be a bug, which needs to be fixed, since the docs say that listType should have one of the values enumerated there, and logically too, it should.

Thank you.

Michael Cloonan (AdWords API Team)

unread,
Sep 26, 2016, 8:14:14 AM9/26/16
to AdWords API Forum
Hello,

This list is a "Visitors of a page who did not visit another page" list in the web interface, which is not yet fully supported by the API. Currently only "Visitors of a page" and "Visitors of a page during specific dates" are supported.

I have requested that we support more types of rule-based user lists in the API when created on the web interface, but they are not available yet.

Regards,
Mike, AdWords API Team

kondiment test

unread,
May 3, 2017, 9:56:06 AM5/3/17
to AdWords API Forum
Hi Mike!

I want to say that I have created a list in the AdWords UI of type Visitors of a page, but with advanced options, and when I import this list through the API I get a list of type UserList, with listType null and with no way of getting its rules.

Is "Visitors of a page" with advanced options not available through the API either or is this a bug?

Thank you.

Michael Cloonan (AdWords API Team)

unread,
May 3, 2017, 10:06:41 AM5/3/17
to AdWords API Forum
Hello,

That is correct, the advanced options do push it into the bucket of unsupported list types via the API. That should be included along with the other requested types from this thread, if that feature is indeed built out into the API. I can say that the team is still aware of the request, but I unfortunately cannot provide any timelines or guarantees as to whether it will make it into the API.

Regards,
Mike, AdWords API Team

kondiment test

unread,
May 3, 2017, 10:25:55 AM5/3/17
to AdWords API Forum
Thank you, Mike!
Reply all
Reply to author
Forward
0 new messages