Re: How to Bid at the Criterion Level using Google Ads Api
Hello Paul, Your code helped me a lot to make mine. So i will add how i did one code to bid at ad group level. Thanks for this tread. ad_group_criterion_service = client.get_service('AdGroupCriterionService', version='v2') ad_group_criterion_operation = client.get_type('AdGroupCriterionOperation', version='v2') ad_group_criterion = ad_group_criterion_operation.update ad_group_criterion.resource_name = ad_group_criterion_service.ad_group_criteria_path( customer_id, ResourceName.format_composite(ad_group_id, criteria_id)) ad_group_criterion.bid_modifier.value = 3 fm = protobuf_helpers.field_mask(None, ad_group_criterion) ad_group_criterion_operation.update_mask.CopyFrom(fm) ad_group_criterion_service.mutate_ad_group_criteria(customer_id, [ad_group_criterion_operation]) -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com 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 "AdWords API and Google Ads API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/82de0bca-f28e-463a-a7ca-f0e2bb9f25b5%40googlegroups.com.
RE: How to Bid at the Criterion Level using Google Ads Api
Hello Paul, I was able to set the cpc_bid_micros for the keyword using the Python client library. Please find the code snippet below as a reference. ad_group_criterion.ad_group.value = ad_group_service.ad_group_path(customer_id, ad_group_id) ad_group_criterion.status = client.get_type('AdGroupCriterionStatusEnum').ENABLED ad_group_criterion.keyword.text.value = keyword ad_group_criterion.cpc_bid_micros.value = 256 ad_group_criterion.keyword.match_type = client.get_type('KeywordMatchTypeEnum').EXACT Could you please share the complete request and response logs which will help us troubleshoot the issue? Could you please share details of the Python client library version that you're using? Thanks, Bharani, Google Ads API Team ref:_00D1U1174p._5001UBloxd:ref -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com 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 "AdWords API and Google Ads API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/08ZrX0PSP0TG00MleqalyJSwqbd-j0MH0odA%40sfdc.net.
How to Bid at the Criterion Level using Google Ads Api
I am trying to use the Google Ads API but my understanding of this library is limited. I have created a client and am trying to update cpc_bid_micros. I am getting the following output and am unable to diagnosis it any further. Any help would be appreciated. ad_group_criterion.resource_name customers/5420633870/adGroupCriteria/67392656629~1734040956 ad_group_criterion 0 ad_group_criterion 256 Request made: ClientCustomerId: 5420633870, Host: googleads.googleapis.com:443, Method: /google.ads.googleads.v1.services.AdGroupCriterionService/MutateAdGroupCriteria, RequestId: rr-awPlHu-PMzNzOJULvOQ, IsFault: True, FaultMessage: Resource was not found. Request with ID "rr-awPlHu-PMzNzOJULvOQ" failed with status "INVALID_ARGUMENT" and includes the following errors: Error with message "Resource was not found.". On field: operations On field: update On field: resource_name def main(client, customer_id, ad_group_id, criterion_id): > agc_service = client.get_service('AdGroupCriterionService', version='v1') > > ad_group_criterion_operation = > client.get_type('AdGroupCriterionOperation', >version='v1') > > > ad_group_criterion = ad_group_criterion_operation.update > ad_group_criterion.resource_name = agc_service.ad_group_criteria_path( > customer_id, ResourceName.format_composite(ad_group_id, criterion_id)) > print("ad_group_criterion.resource_name", > ad_group_criterion.resource_name) > print('ad_group_criterion', ad_group_criterion.cpc_bid_micros.value) > ad_group_criterion.status = client.get_type('AdGroupCriterionStatusEnum', > version='v1').ENABLED > ad_group_criterion.cpc_bid_micros.value = 256 > print('ad_group_criterion', ad_group_criterion.cpc_bid_micros.value) > fm = protobuf_helpers.field_mask(None, ad_group_criterion) > ad_group_criterion_operation.update_mask.CopyFrom(fm) > > > > try: > # > agc_response = agc_service.mutate_ad_group_criteria( > customer_id, [ad_group_criterion_operation]) > except google.ads.google_ads.errors.GoogleAdsException as ex: > print('Request with ID "%s" failed with status "%s" and includes the ' > 'following errors:' % (ex.request_id, ex.error.code().name)) > for error in ex.failure.errors: > print('\tError with message "%s".' % error.message) > if error.location: > for field_path_element in error.location.field_path_elements: > print('\t\tOn field: %s' % field_path_element.field_name) > sys.exit(1) > > print('Updated keyword %s.' % agc_response.results[0].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 adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com 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 "AdWords API and Google Ads API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/c12a3d49-8c12-40ae-9a05-73c2f570e993%40googlegroups.com.