The Google Ads API provides some
recommendation types to
help you optimize your campaign budgets:
CAMPAIGN_BUDGET
suggests a new budget amount for budget-constrained campaigns.
MOVE_UNUSED_BUDGET
highlights opportunities to reallocate excess budget from one campaign to
another budget-constrained campaign.
MARGINAL_ROI_CAMPAIGN_BUDGET
suggests a new budget amount for campaigns whose ROI is predicted to
increase with a budget adjustment.
FORECASTING_CAMPAIGN_BUDGET
suggests a new budget amount for campaigns that are expected to become
budget-constrained in the future.
For additional recommendation types and guidance on working with recommendations
in the Google Ads API, visit the
Optimization score and recommendations guide.
[null,null,["Last updated 2025-08-25 UTC."],[[["\u003cp\u003eThis page provides code samples in various programming languages (Java, C#, PHP, Python, Ruby, Perl) for creating a new average daily budget for a Google Ads campaign.\u003c/p\u003e\n"],["\u003cp\u003eBy default, campaign budgets are shareable, meaning they can be used across multiple campaigns.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Ads API offers budget optimization recommendations such as adjusting budget for constrained campaigns, reallocating unused budget, and forecasting future budget needs.\u003c/p\u003e\n"],["\u003cp\u003eThese recommendations help improve campaign performance and ROI by ensuring efficient budget allocation.\u003c/p\u003e\n"]]],[],null,["# Create a Campaign Budget\n\nThe following example creates a new average daily budget for a campaign.\n| **Key Point:** A campaign budget is [shareable](/google-ads/api/docs/campaigns/budgets/share-budgets) by default.\n\n\n### Java\n\n```java\nprivate static String addCampaignBudget(GoogleAdsClient googleAdsClient, long customerId) {\n CampaignBudget budget =\n CampaignBudget.newBuilder()\n .setName(\"Interplanetary Cruise Budget #\" + getPrintableDateTime())\n .setDeliveryMethod(BudgetDeliveryMethod.STANDARD)\n .setAmountMicros(500_000)\n .build();\n\n CampaignBudgetOperation op = CampaignBudgetOperation.newBuilder().setCreate(budget).build();\n\n try (CampaignBudgetServiceClient campaignBudgetServiceClient =\n googleAdsClient.getLatestVersion().createCampaignBudgetServiceClient()) {\n MutateCampaignBudgetsResponse response =\n campaignBudgetServiceClient.mutateCampaignBudgets(\n Long.toString(customerId), ImmutableList.of(op));\n String budgetResourceName = response.getResults(0).getResourceName();\n System.out.printf(\"Added budget: %s%n\", budgetResourceName);\n return budgetResourceName;\n }\n}https://github.com/googleads/google-ads-java/blob/3c3c1041c2a0ab81553e3b2a79876256649397ed/google-ads-examples/src/main/java/com/google/ads/googleads/examples/basicoperations/AddCampaigns.java#L107-L126\n \n```\n\n### C#\n\n```c#\nprivate static string CreateBudget(GoogleAdsClient client, long customerId)\n{\n // Get the BudgetService.\n CampaignBudgetServiceClient budgetService = client.GetService(\n Services.V21.CampaignBudgetService);\n\n // Create the campaign budget.\n CampaignBudget budget = new CampaignBudget()\n {\n Name = \"Interplanetary Cruise Budget #\" + ExampleUtilities.GetRandomString(),\n DeliveryMethod = BudgetDeliveryMethod.Standard,\n AmountMicros = 500000\n };\n\n // Create the operation.\n CampaignBudgetOperation budgetOperation = new CampaignBudgetOperation()\n {\n Create = budget\n };\n\n // Create the campaign budget.\n MutateCampaignBudgetsResponse response = budgetService.MutateCampaignBudgets(\n customerId.ToString(), new CampaignBudgetOperation[] { budgetOperation });\n return response.Results[0].ResourceName;\n}https://github.com/googleads/google-ads-dotnet/blob/ada966e1983b655e82172b6c3e7d9b091b522377/Google.Ads.GoogleAds/examples/BasicOperations/AddCampaigns.cs#L170-L194\n \n```\n\n### PHP\n\n```php\nprivate static function addCampaignBudget(GoogleAdsClient $googleAdsClient, int $customerId)\n{\n // Creates a campaign budget.\n $budget = new CampaignBudget([\n 'name' =\u003e 'Interplanetary Cruise Budget #' . Helper::getPrintableDatetime(),\n 'delivery_method' =\u003e BudgetDeliveryMethod::STANDARD,\n 'amount_micros' =\u003e 500000\n ]);\n\n // Creates a campaign budget operation.\n $campaignBudgetOperation = new CampaignBudgetOperation();\n $campaignBudgetOperation-\u003esetCreate($budget);\n\n // Issues a mutate request.\n $campaignBudgetServiceClient = $googleAdsClient-\u003egetCampaignBudgetServiceClient();\n $response = $campaignBudgetServiceClient-\u003emutateCampaignBudgets(\n MutateCampaignBudgetsRequest::build($customerId, [$campaignBudgetOperation])\n );\n\n /** @var CampaignBudget $addedBudget */\n $addedBudget = $response-\u003egetResults()[0];\n printf(\"Added budget named '%s'%s\", $addedBudget-\u003egetResourceName(), PHP_EOL);\n\n return $addedBudget-\u003egetResourceName();\n} \nhttps://github.com/googleads/google-ads-php/blob/be0249c30c27b4760387bec6682b82c9f4167761/examples/BasicOperations/AddCampaigns.php#L176-L200\n\n \n```\n\n### Python\n\n```python\n# Create a budget, which can be shared by multiple campaigns.\ncampaign_budget_operation: CampaignBudgetOperation = client.get_type(\n \"CampaignBudgetOperation\"\n)\ncampaign_budget: CampaignBudget = campaign_budget_operation.create\ncampaign_budget.name = f\"Interplanetary Budget {uuid.uuid4()}\"\ncampaign_budget.delivery_method = (\n client.enums.BudgetDeliveryMethodEnum.STANDARD\n)\ncampaign_budget.amount_micros = 500000\n\n# Add budget.\ncampaign_budget_response: MutateCampaignBudgetsResponse\ntry:\n budget_operations: List[CampaignBudgetOperation] = [\n campaign_budget_operation\n ]\n campaign_budget_response = (\n campaign_budget_service.mutate_campaign_budgets(\n customer_id=customer_id,\n operations=budget_operations,\n )\n )\nexcept GoogleAdsException as ex:\n handle_googleads_exception(ex)https://github.com/googleads/google-ads-python/blob/d0595698b8a7de6cc00684b467462601037c9db9/examples/basic_operations/add_campaigns.py#L61-L85\n \n```\n\n### Ruby\n\n```ruby\n# Create a budget, which can be shared by multiple campaigns.\ncampaign_budget = client.resource.campaign_budget do |cb|\n cb.name = \"Interplanetary Budget #{(Time.new.to_f * 1000).to_i}\"\n cb.delivery_method = :STANDARD\n cb.amount_micros = 500000\nend\n\noperation = client.operation.create_resource.campaign_budget(campaign_budget)\n\n# Add budget.\nreturn_budget = client.service.campaign_budget.mutate_campaign_budgets(\n customer_id: customer_id,\n operations: [operation],\n)https://github.com/googleads/google-ads-ruby/blob/2752563c7ffd15a4d2238116869f64aea3011cc3/examples/basic_operations/add_campaigns.rb#L30-L43\n \n```\n\n### Perl\n\n```perl\n# Create a campaign budget, which can be shared by multiple campaigns.\nmy $campaign_budget =\n Google::Ads::GoogleAds::V21::Resources::CampaignBudget-\u003enew({\n name =\u003e \"Interplanetary budget #\" . uniqid(),\n deliveryMethod =\u003e STANDARD,\n amountMicros =\u003e 500000\n });\n\n# Create a campaign budget operation.\nmy $campaign_budget_operation =\n Google::Ads::GoogleAds::V21::Services::CampaignBudgetService::CampaignBudgetOperation\n -\u003enew({create =\u003e $campaign_budget});\n\n# Add the campaign budget.\nmy $campaign_budgets_response = $api_client-\u003eCampaignBudgetService()-\u003emutate({\n customerId =\u003e $customer_id,\n operations =\u003e [$campaign_budget_operation]});https://github.com/googleads/google-ads-perl/blob/9abffd69cd856633dfdcee5c636fe9cd0eb4b5ed/examples/basic_operations/add_campaigns.pl#L60-L76\n \n```\n\n\u003cbr /\u003e\n\nCampaign budget recommendations\n-------------------------------\n\nThe Google Ads API provides some\n[recommendation](//support.google.com/google-ads/answer/3448398) types to\nhelp you optimize your campaign budgets:\n\n- [`CAMPAIGN_BUDGET`](/google-ads/api/reference/rpc/v21/Recommendation#campaign_budget_recommendation)\n suggests a new budget amount for budget-constrained campaigns.\n\n- [`MOVE_UNUSED_BUDGET`](/google-ads/api/reference/rpc/v21/Recommendation#move_unused_budget_recommendation)\n highlights opportunities to reallocate excess budget from one campaign to\n another budget-constrained campaign.\n\n- [`MARGINAL_ROI_CAMPAIGN_BUDGET`](/google-ads/api/reference/rpc/v21/Recommendation#marginal_roi_campaign_budget_recommendation)\n suggests a new budget amount for campaigns whose ROI is predicted to\n increase with a budget adjustment.\n\n- [`FORECASTING_CAMPAIGN_BUDGET`](/google-ads/api/reference/rpc/v21/Recommendation#forecasting_campaign_budget_recommendation)\n suggests a new budget amount for campaigns that are expected to become\n budget-constrained in the future.\n\nFor additional recommendation types and guidance on working with recommendations\nin the Google Ads API, visit the\n[Optimization score and recommendations](/google-ads/api/docs/recommendations) guide."]]