Hello,
I've been struggling to integrate API Bidding Updates (Mutates) for Campaigns and AdGroups.
Library used:
Google Ads API Python Client LibraryVersion:
21.2.0Currently, I've only managed to get working API Bidding Updates (Mutates) for Campaigns using TARGET_ROAS and TARGET_CPA, and for AdGroups using MANUAL_CPC, MANUAL_CPM and TARGET_CPM.
My goal is to be able to provide API Bidding Updates (Mutates) for all the available bidding strategies, by using the
Google Ads API Python Client Library. Important Note: The only type of Campaigns that we are interested in are
App Campaigns.Example of failed request (and response) for setting MANUAL_CPC for a Campaign:
[2023-07-12 10:24:46 - INFO] Request
-------
Method: /google.ads.googleads.v14.services.CampaignService/MutateCampaigns
Host:
googleads.googleapis.comHeaders: {
"developer-token": "REDACTED",
"login-customer-id": "
9126245774",
"x-goog-api-client": "gl-python/3.11.4 grpc/1.54.2 gax/2.11.0 gccl/21.2.0 pb/4.23.2",
"x-goog-request-params": "customer_id=2371697191"
}
Request: customer_id: "2371697191"
operations {
update_mask {
paths: "resource_name"
paths: "app_campaign_setting.bidding_strategy_goal_type"
paths: "manual_cpc.enhanced_cpc_enabled"
}
update {
resource_name: "customers/2371697191/campaigns/
14304399031"
app_campaign_setting {
bidding_strategy_goal_type: OPTIMIZE_INSTALLS_TARGET_INSTALL_COST
}
manual_cpc {
enhanced_cpc_enabled: true
}
}
}
Response
-------
Headers: {
"google.ads.googleads.v14.errors.googleadsfailure-bin": "\nr\n\u0003\u0003\u0002\u00123The operation is not allowed for the given context.\u001a\f*\nMANUAL_CPC\"(\u0012\u000e\n\noperations\u0018\u0000\u0012\b\n\u0006update\u0012\f\n\nmanual_cpc\u0012\u0016a3jdlHwU1x1MFIYrWhixDw",
"grpc-status-details-bin": "\b\u0003\u0012%Request contains an invalid argument.\u001a\u0001\
nDtype.googleapis.com/google.ads.googleads.v14.errors.GoogleAdsFailure\u0012\u0001\nr\n\u0003\u0003\u0002\u00123The operation is not allowed for the given context.\u001a\f*\nMANUAL_CPC\"(\u0012\u000e\n\noperations\u0018\u0000\u0012\b\n\u0006update\u0012\f\n\nmanual_cpc\u0012\u0016a3jdlHwU1x1MFIYrWhixDw",
"request-id": "a3jdlHwU1x1MFIYrWhixDw"
}
Fault: errors {
error_code {
context_error: OPERATION_NOT_PERMITTED_FOR_CONTEXT
}
message: "The operation is not allowed for the given context."
trigger {
string_value: "MANUAL_CPC"
}
location {
field_path_elements {
field_name: "operations"
index: 0
}
field_path_elements {
field_name: "update"
}
field_path_elements {
field_name: "manual_cpc"
}
}
}
request_id: "a3jdlHwU1x1MFIYrWhixDw"
The error "The operation is not allowed for the given context." is quite generic and doesn't really provide any useful information to understand why this operation is not allowed. The exact same error is raised for all the other Bidding Strategies attempted.
Thank you!