SelectorError.INVALID_FIELD_NAME @ selector; trigger:'GenderType'

20 views
Skip to first unread message

tahirhany...@gmail.com

unread,
Nov 21, 2018, 1:11:14 AM11/21/18
to AdWords API and Google Ads API Forum

Hi, i am trying to add different types of criterions to selector and get the reach number according to that criterions. In below code i tried to add gender type criterion to selector but i get error.

Code 


def get_reach(client, country_list, gender_list):
# Initialize appropriate service.
location_criterion_service
= client.GetService(
'LocationCriterionService', version='v201809')

# Create the selector.
selector
= {
   
'fields': ['Id', 'LocationName', 'DisplayType', 'GenderType', 'CanonicalName', 'Reach', 'TargetingStatus'],
   
'predicates': [{
       
'field': 'LocationName',
       
'operator': 'EQUALS',
       
'values': country_list
   
},{
       
'field': 'GenderType',
       
'operator': 'EQUALS',
       
'values': gender_list
   
}]
}

# Make the get request.
location_criteria
= location_criterion_service.get(selector)


Output

googleads.errors.GoogleAdsServerFault: [SelectorError.INVALID_FIELD_NAME @ selector; trigger:'GenderType', SelectorError.INVALID_PREDICATE_FIELD_NAME @ selector; trigger:'GenderType']


Peter Oliquino (AdWords API Team)

unread,
Nov 21, 2018, 4:06:41 AM11/21/18
to AdWords API and Google Ads API Forum
Hi,

The SelectorError.INVALID_FIELD_NAME error occurs because GenderType field is a field of Gender criterion and this type of criterion can only be used for AdGroupCriterionServiceCampaignCriterionService, and ConstantDataService. The LocationCriterionService can only contain selectors under LocationCriterion and Location

Best regards,
Peter
AdWords API Team
Reply all
Reply to author
Forward
0 new messages