Hi Dan,
I understand you are having trouble while creating the App campaigns via Google Ads API and to assist you better I would like a few confirmation from your end. Could you please confirm if you have followed this guide while creating the App Campaigns and you are not specifying the portfolio bidding strategy for your campaign? The bidding strategy types that are supported for these campaign types are listed in the preparation section of the guide. Could you please give this a try and let me know if you are still facing this issue?
Regards,
Nikisha Patel, Google Ads API Team
Hi Nikisha, thanks for your reply!
Yes I’ve followed the guide. There is a code sample:
campaign_operation = ga_client.get_type('CampaignOperation', version='v2')
campaign = campaign_operation.create
campaign.name.value = 'Test API campaign'
campaign.advertising_channel_type = ga_client.get_type('AdvertisingChannelTypeEnum').MULTI_CHANNEL
campaign.advertising_channel_sub_type = ga_client.get_type('AdvertisingChannelSubTypeEnum').APP_CAMPAIGN
campaign.AppCampaignSetting.app_store = ga_client.get_type('AppCampaignAppStoreEnum').APPLE_APP_STORE
campaign.AppCampaignSetting.app_id = '123456789'
campaign.AppCampaignSetting.bidding_strategy_goal_type =\
ga_client.get_type('AppCampaignBiddingStrategyGoalTypeEnum').OPTIMIZE_INSTALLS_TARGET_INSTALL_COST
campaign.status = ga_client.get_type('CampaignStatusEnum', version='v2').PAUSED
campaign_budget_service = ga_client.get_service('CampaignBudgetService',version='v2')
campaign_budget_operation = ga_client.get_type('CampaignBudgetOperation',
version='v2')
campaign_budget = campaign_budget_operation.create
campaign_budget.name.value = 'Test budget'
campaign_budget.delivery_method = ga_client.get_type(
'BudgetDeliveryMethodEnum').STANDARD
campaign_budget.amount_micros.value = 500000
campaign_budget.explicitly_shared.value = False
# Add budget.
try:
campaign_budget_response = (
campaign_budget_service.mutate_campaign_budgets(
test_id, [campaign_budget_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)
campaign.campaign_budget.value = (campaign_budget_response.results[0].resource_name)
campaign_service = ga_client.get_service('CampaignService', version='v2')
campaign_response = campaign_service.mutate_campaigns(test_id, [campaign_operation])
If I run this code I’ve got an error:
{
error_code {
field_error: REQUIRED
}
message: "The required field was not present."
trigger {
string_value: ""
}
location {
field_path_elements {
field_name: "operations"
index {
}
}
field_path_elements {
field_name: "create"
}
field_path_elements {
field_name: "campaign_bidding_strategy"
}
}
}
And if I add following code for bidding strategy and run:
campaign_bid_strategy_service = ga_client.get_service('BiddingStrategyService', version='v2')
campaign_bid_strategy_operation = ga_client.get_type('BiddingStrategyOperation', version='v2')
campaign_bid_strategy = campaign_bid_strategy_operation.create
campaign_bid_strategy.name.value = 'Test bid'
campaign_bid_strategy.type = ga_client.get_type('BiddingStrategyTypeEnum').TARGET_CPA
campaign_bid_strategy.target_cpa.target_cpa_micros.value = 50000
# Add bid.
try:
campaign_bid_strategy_response = (
campaign_bid_strategy_service.mutate_bidding_strategies(
test_id, [campaign_bid_strategy_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)
campaign.bidding_strategy.value = (campaign_bid_strategy_response.results[0].resource_name)
I’ve got another error:
{
error_code {
operation_access_denied_error: OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE
}
message: "This operation is not permitted on this campaign type"
trigger {
string_value: ""
}
location {
field_path_elements {
field_name: "operations"
index {
}
}
field_path_elements {
field_name: "create"
}
field_path_elements {
field_name: "bidding_strategy"
}
}
}
I understand that I’ve created portfolio bidding strategy, and I cannot use it with an app campaign, however I don’t know how to create simple bidding strategy.
Thanks!
Hi Dan,
Thank you for sharing the details. As mentioned earlier in my email, the bidding strategy types that are supported are listed in the preparation section of the guide. Please find attached the request and response logs from my testing for your reference. Please give this a try and if the issue persists, could you please share the complete request and response logs by enabling the logging by following the steps from this guide for me to investigate this further?
Regards,
Nikisha Patel, Google Ads API Team