Google Ads API: Setting user list for adgroup criterion

93 views
Skip to first unread message

Matt Fleming

unread,
Sep 18, 2019, 6:29:57 PM9/18/19
to AdWords API and Google Ads API Forum
Hi,

Hope this message finds you well.

I need some help applying user_list criteria to my ad_group. I keep getting the error "AttributeError: Assignment not allowed to field "user_list" in protocol message object."

def set_targeting(self, client, customer_id, ad_group_id, audience_id):
ad_group_service = client.get_service('AdGroupService', version='v2')
ad_group_criterion_service = client.get_service('AdGroupCriterionService', version='v2')
ad_group_criterion_operations = client.get_type('AdGroupCriterionOperation', version='v2')

ad_group_criterion = ad_group_criterion_operations.create
ad_group_criterion.ad_group.value = ad_group_service.ad_group_path(
customer_id, ad_group_id)
ad_group_criterion.type = client.get_type('CriterionTypeEnum', version='v2').USER_LIST
ad_group_criterion.user_list = audience_id

Any advice would be appreciated.

Thanks!

-Matt

Google Ads API Forum Advisor Prod

unread,
Sep 19, 2019, 5:45:22 PM9/19/19
to ma...@blabb.io, adwor...@googlegroups.com

Hi Matt,

Thank you for writing to us. You should be able to apply user_list criteria to your ad group by setting the user_list criterion. Could you please give this a try and let me know if you still have any issues? 

Regards,
Nikisha Patel, Google Ads API Team



ref:_00D1U1174p._5001UHHH4C:ref
Reply all
Reply to author
Forward
0 new messages