Kampanya Bütçesi Oluşturma
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Aşağıdaki örnekte, bir kampanya için yeni bir ortalama günlük bütçe oluşturulmaktadır.
Java
private static String addCampaignBudget(GoogleAdsClient googleAdsClient, long customerId) {
CampaignBudget budget =
CampaignBudget.newBuilder()
.setName("Interplanetary Cruise Budget #" + getPrintableDateTime())
.setDeliveryMethod(BudgetDeliveryMethod.STANDARD)
.setAmountMicros(500_000)
.build();
CampaignBudgetOperation op = CampaignBudgetOperation.newBuilder().setCreate(budget).build();
try (CampaignBudgetServiceClient campaignBudgetServiceClient =
googleAdsClient.getLatestVersion().createCampaignBudgetServiceClient()) {
MutateCampaignBudgetsResponse response =
campaignBudgetServiceClient.mutateCampaignBudgets(
Long.toString(customerId), ImmutableList.of(op));
String budgetResourceName = response.getResults(0).getResourceName();
System.out.printf("Added budget: %s%n", budgetResourceName);
return budgetResourceName;
}
}
C#
private static string CreateBudget(GoogleAdsClient client, long customerId)
{
// Get the BudgetService.
CampaignBudgetServiceClient budgetService = client.GetService(
Services.V21.CampaignBudgetService);
// Create the campaign budget.
CampaignBudget budget = new CampaignBudget()
{
Name = "Interplanetary Cruise Budget #" + ExampleUtilities.GetRandomString(),
DeliveryMethod = BudgetDeliveryMethod.Standard,
AmountMicros = 500000
};
// Create the operation.
CampaignBudgetOperation budgetOperation = new CampaignBudgetOperation()
{
Create = budget
};
// Create the campaign budget.
MutateCampaignBudgetsResponse response = budgetService.MutateCampaignBudgets(
customerId.ToString(), new CampaignBudgetOperation[] { budgetOperation });
return response.Results[0].ResourceName;
}
PHP
private static function addCampaignBudget(GoogleAdsClient $googleAdsClient, int $customerId)
{
// Creates a campaign budget.
$budget = new CampaignBudget([
'name' => 'Interplanetary Cruise Budget #' . Helper::getPrintableDatetime(),
'delivery_method' => BudgetDeliveryMethod::STANDARD,
'amount_micros' => 500000
]);
// Creates a campaign budget operation.
$campaignBudgetOperation = new CampaignBudgetOperation();
$campaignBudgetOperation->setCreate($budget);
// Issues a mutate request.
$campaignBudgetServiceClient = $googleAdsClient->getCampaignBudgetServiceClient();
$response = $campaignBudgetServiceClient->mutateCampaignBudgets(
MutateCampaignBudgetsRequest::build($customerId, [$campaignBudgetOperation])
);
/** @var CampaignBudget $addedBudget */
$addedBudget = $response->getResults()[0];
printf("Added budget named '%s'%s", $addedBudget->getResourceName(), PHP_EOL);
return $addedBudget->getResourceName();
}
Python
# Create a budget, which can be shared by multiple campaigns.
campaign_budget_operation: CampaignBudgetOperation = client.get_type(
"CampaignBudgetOperation"
)
campaign_budget: CampaignBudget = campaign_budget_operation.create
campaign_budget.name = f"Interplanetary Budget {uuid.uuid4()}"
campaign_budget.delivery_method = (
client.enums.BudgetDeliveryMethodEnum.STANDARD
)
campaign_budget.amount_micros = 500000
# Add budget.
campaign_budget_response: MutateCampaignBudgetsResponse
try:
budget_operations: List[CampaignBudgetOperation] = [
campaign_budget_operation
]
campaign_budget_response = (
campaign_budget_service.mutate_campaign_budgets(
customer_id=customer_id,
operations=budget_operations,
)
)
except GoogleAdsException as ex:
handle_googleads_exception(ex)
Ruby
# Create a budget, which can be shared by multiple campaigns.
campaign_budget = client.resource.campaign_budget do |cb|
cb.name = "Interplanetary Budget #{(Time.new.to_f * 1000).to_i}"
cb.delivery_method = :STANDARD
cb.amount_micros = 500000
end
operation = client.operation.create_resource.campaign_budget(campaign_budget)
# Add budget.
return_budget = client.service.campaign_budget.mutate_campaign_budgets(
customer_id: customer_id,
operations: [operation],
)
Perl
# Create a campaign budget, which can be shared by multiple campaigns.
my $campaign_budget =
Google::Ads::GoogleAds::V21::Resources::CampaignBudget->new({
name => "Interplanetary budget #" . uniqid(),
deliveryMethod => STANDARD,
amountMicros => 500000
});
# Create a campaign budget operation.
my $campaign_budget_operation =
Google::Ads::GoogleAds::V21::Services::CampaignBudgetService::CampaignBudgetOperation
->new({create => $campaign_budget});
# Add the campaign budget.
my $campaign_budgets_response = $api_client->CampaignBudgetService()->mutate({
customerId => $customer_id,
operations => [$campaign_budget_operation]});
Kampanya bütçesi önerileri
Google Ads API, kampanya bütçelerinizi optimize etmenize yardımcı olmak için bazı öneri türleri sunar:
CAMPAIGN_BUDGET
Bütçe kısıtlamalı kampanyalar için yeni bir bütçe tutarı önerir.
MOVE_UNUSED_BUDGET
Bir kampanyadaki fazla bütçeyi, bütçe kısıtlamalı başka bir kampanyaya yeniden paylaştırma fırsatlarını öne çıkarır.
MARGINAL_ROI_CAMPAIGN_BUDGET
YG'sinin bütçe ayarlamasıyla artacağı tahmin edilen kampanyalar için yeni bir bütçe tutarı önerir.
FORECASTING_CAMPAIGN_BUDGET
gelecekte bütçe kısıtlamasıyla karşılaşması beklenen kampanyalar için yeni bir bütçe tutarı önerir.
Ek öneri türleri ve Google Ads API'de önerilerle çalışma hakkında rehberlik için Optimizasyon puanı ve öneriler kılavuzunu ziyaret edin.
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-08-31 UTC.
[null,null,["Son güncelleme tarihi: 2025-08-31 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."]]