Hi,
I tried to set the audience that I created to ad group criterion but I got
the error: "TypeError: Parameter to MergeFrom() must be instance of same
class: expected google.ads.googleads.v10.services.AdGroupCriterionOperation
got google.ads.googleads.v10.resources.AdGroupCriterion."
What do I do wrong? with this snippet:
ad_group_service = client.get_service("AdGroupService")
ad_group_criterion_service =
client.get_service("AdGroupCriterionService")
ad_group_resource_name = ad_group_service.ad_group_path(
customer_id, ad_group_id
)
Thank you in advance.
audience_resource = 'customers/7979218831/audiences/5414975'
# Create a positive ad group criterion for the gender MALE.
audience_ad_group_criterion_operation = client.get_type(
"AdGroupCriterionOperation"
)
audience_ad_group_criterion =
audience_ad_group_criterion_operation.create
audience_ad_group_criterion.ad_group = ad_group_resource_name
audience_ad_group_criterion.audience.audience=audience_resource
# Add ad group criteria
ad_group_criterion_response = (
ad_group_criterion_service.mutate_ad_group_criteria(
customer_id=customer_id,
operations=[
audience_ad_group_criterion
],
)
)
for result in ad_group_criterion_response.results:
print("Created keyword {}.".format(result.resource_name))
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/a178c39f-1798-41b0-bd93-2142e4765523n%40googlegroups.com.