Good day, My team are using Google Ads API v8 and we have a set of unit test cases that run from time to time to check if we are using API in the right way.
>From today, we noticed a test case started failing. It is about setting the TARGET_CPA bidding strategy to a Search campaign ( which was created with MANUAL_CPC). The last time the case has passed was 2 days ago. Wonder if any changes in the API in these 2 days and what actions I should take to make it work. Request and response details and the code *Request* Method: /google.ads.googleads.v8.services.CampaignService/MutateCampaigns Host: googleads.googleapis.com Headers: { "developer-token": "REDACTED", "login-customer-id": "PLEASE LET ME KNOW IF YOU NEED THIS INFORMATION", "x-goog-api-client": "gl-python/3.9.4 grpc/1.39.0 gax/1.31.2 gapic/13.0.0", "x-goog-request-params": "customer_id=PLEASE LET ME KNOW IF YOU NEED THIS INFORMATION" } Request: customer_id: "PLEASE LET ME KNOW IF YOU NEED THIS INFORMATION" operations { update { resource_name: "customers/PLEASE LET ME KNOW IF YOU NEED THIS INFORMATION/campaigns/14825758506" bidding_strategy_type: TARGET_CPA target_cpa { target_cpa_micros: 10000000 cpc_bid_ceiling_micros: 100000000 cpc_bid_floor_micros: 10000000 } } update_mask { paths: "resource_name" paths: "bidding_strategy_type" paths: "target_cpa.target_cpa_micros" paths: "target_cpa.cpc_bid_ceiling_micros" paths: "target_cpa.cpc_bid_floor_micros" } } *Response* ------- Headers: { "google.ads.googleads.v8.errors.googleadsfailure-bin": "\n\u0001\n\u0003\u0001\n\u0012ABidding strategy is not supported or cannot be used as anonymous.\u001a\f*\nTARGET_CPA\"(\u0012\u000e\n\noperations\u0018\u0000\u0012\b\n\u0006update\u0012\f\n\ntarget_cpa\u0012\u0016sHRSjMmPQ_THj4x-mcNZJw", "grpc-status-details-bin": "\b\u0003\u0012%Request contains an invalid argument.\u001a\u0001\nCtype.googleapis.com/google.ads.googleads.v8.errors.GoogleAdsFailure\u0012\u0001\n\u0001\n\u0003\u0001\n\u0012ABidding strategy is not supported or cannot be used as anonymous.\u001a\f*\nTARGET_CPA\"(\u0012\u000e\n\noperations\u0018\u0000\u0012\b\n\u0006update\u0012\f\n\ntarget_cpa\u0012\u0016sHRSjMmPQ_THj4x-mcNZJw", "request-id": "sHRSjMmPQ_THj4x-mcNZJw" } Fault: errors { error_code { bidding_error: INVALID_ANONYMOUS_BIDDING_STRATEGY_TYPE } message: "Bidding strategy is not supported or cannot be used as anonymous." trigger { string_value: "TARGET_CPA" } location { field_path_elements { field_name: "operations" index: 0 } field_path_elements { field_name: "update" } field_path_elements { field_name: "target_cpa" } } } request_id: "sHRSjMmPQ_THj4x-mcNZJw" ( Note since it is in our test case, the request was sent to the sandbox environment ) *Code* import uuid from google.ads.googleads.client import GoogleAdsClient from google.ads.googleads.v8.enums.types.bidding_strategy_type import BiddingStrategyTypeEnum from google.api_core import protobuf_helpers def main(client, customer_id): uid = uuid.uuid4() campaign_budget_service = client.get_service("CampaignBudgetService") campaign_service = client.get_service("CampaignService") # Create a budget, which can be shared by multiple campaigns. campaign_budget_operation = client.get_type("CampaignBudgetOperation") campaign_budget = campaign_budget_operation.create campaign_budget.name = f"Bidding strategy test campaign budget {uid}" campaign_budget.delivery_method = ( client.enums.BudgetDeliveryMethodEnum.STANDARD ) campaign_budget.amount_micros = 10000000 campaign_budget_response = ( campaign_budget_service.mutate_campaign_budgets( customer_id=customer_id, operations=[campaign_budget_operation] ) ) # Create campaign. campaign_operation = client.get_type("CampaignOperation") campaign = campaign_operation.create campaign.name = f"Bidding strategy test campaign {uid}" campaign.advertising_channel_type = ( client.enums.AdvertisingChannelTypeEnum.SEARCH ) campaign.bidding_strategy_type = ( BiddingStrategyTypeEnum.BiddingStrategyType.MANUAL_CPC ) # Recommendation: Set the campaign to PAUSED when creating it to prevent # the ads from immediately serving. Set to ENABLED once you've added # targeting and the ads are ready to serve. campaign.status = client.enums.CampaignStatusEnum.PAUSED # Set the bidding strategy and budget. campaign.manual_cpc.enhanced_cpc_enabled = True campaign.campaign_budget = campaign_budget_response.results[0].resource_name # Set the campaign network options. campaign.network_settings.target_google_search = True campaign.network_settings.target_search_network = True campaign.network_settings.target_content_network = False campaign.network_settings.target_partner_search_network = False # Add the campaign. campaign_response = campaign_service.mutate_campaigns( customer_id=customer_id, operations=[campaign_operation] ) campaign_resource_name = campaign_response.results[0].resource_name campaign_operation = client.get_type("CampaignOperation") campaign = campaign_operation.update campaign.resource_name = campaign_resource_name campaign.bidding_strategy_type = ( BiddingStrategyTypeEnum.BiddingStrategyType.TARGET_CPA ) campaign.target_cpa.target_cpa_micros = 10000000 campaign.target_cpa.cpc_bid_ceiling_micros = 100000000 campaign.target_cpa.cpc_bid_floor_micros = 10000000 # Retrieve a FieldMask for the fields configured in the campaign. client.copy_from( campaign_operation.update_mask, protobuf_helpers.field_mask(None, campaign._pb), ) campaign_response = campaign_service.mutate_campaigns( customer_id=customer_id, operations=[campaign_operation] ) if __name__ == '__main__': credentials = { 'developer_token': DEVELOPER_TOKEN, 'refresh_token': REFRESH_TOKEN, 'client_id': CLIENT_ID, 'client_secret': CLIENT_SECRET, 'login_customer_id': MASTER_ACCOUNT_ID, } client = GoogleAdsClient.load_from_dict(credentials) main(client, TEST_ACCOUNT_ID) Please let me know if you need any other information. Looking forward to your reply. Regards, Zhe -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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/05ddaa50-df10-409b-ae6d-c3d41b2aa6bcn%40googlegroups.com.