Bid strategy for app campaign

674 views
Skip to first unread message

Dan Zorn

unread,
Oct 17, 2019, 7:42:42 PM10/17/19
to AdWords API and Google Ads API Forum
Hey!

I'm trying to create app campaign with GoogleAds API. 
If I don't specify campaign_bidding_strategy I get error "The required field was not present.". If I specify campaign_bidding_strategy via BiddingStrategyService I get another error: "This operation is not permitted on this campaign type". Any advice?

Thanks!

Google Ads API Forum Advisor Prod

unread,
Oct 18, 2019, 11:33:42 AM10/18/19
to lao...@gmail.com, adwor...@googlegroups.com

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



ref:_00D1U1174p._5001UKNjrT:ref
Message has been deleted
Message has been deleted

Даниил Зорин

unread,
Oct 18, 2019, 11:57:55 AM10/18/19
to AdWords API and Google Ads API Forum

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"
 
  }
 
}
}


Даниил Зорин

unread,
Oct 18, 2019, 11:58:17 AM10/18/19
to AdWords API and Google Ads API Forum

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!

Google Ads API Forum Advisor Prod

unread,
Oct 21, 2019, 1:24:28 PM10/21/19
to lao...@gmail.com, adwor...@googlegroups.com

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



ref:_00D1U1174p._5001UKNjrT:ref
AddAppCampaigns

Dan Zorn

unread,
Oct 22, 2019, 6:38:19 AM10/22/19
to AdWords API and Google Ads API Forum
 Hi Nikisha!

Thanks for your reply. I found a mistake in my code, now everything is ok.
Reply all
Reply to author
Forward
0 new messages