true (پیشفرض): میتواند در بین کمپینهای متعدد به اشتراک گذاشته شود
false : فقط توسط یک کمپین قابل استفاده است
بودجه های به طور صریح به اشتراک گذاشته شده در کتابخانه مشترک یک حساب در رابط کاربری Google Ads ظاهر می شود، در حالی که بودجه غیر مشترک فقط در تنظیمات کمپین مرتبط با آن ظاهر می شود.
در مثال زیر که یک بودجه جدید ایجاد می شود، بودجه به اشتراک گذاشته می شود زیرا explicitly_shared روی true تنظیم شده است.
می توانید با جستجوی فیلد campaign_budget.explicitly_shared مقدار تنظیم بودجه را بازیابی کنید. در اینجا پرس و جوی GAQL برای فیلد، فیلتر بر روی شناسه بودجه است:
تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eGoogle Ads budgets can be applied to a single campaign or shared across multiple campaigns.\u003c/p\u003e\n"],["\u003cp\u003eShared budgets are designated by setting the \u003ccode\u003eexplicitly_shared\u003c/code\u003e field to \u003ccode\u003etrue\u003c/code\u003e during creation and appear in the Shared Library within the Google Ads UI.\u003c/p\u003e\n"],["\u003cp\u003eWhile a budget's shared status can be changed from \u003ccode\u003efalse\u003c/code\u003e to \u003ccode\u003etrue\u003c/code\u003e under certain conditions, it cannot be changed from \u003ccode\u003etrue\u003c/code\u003e to \u003ccode\u003efalse\u003c/code\u003e once created.\u003c/p\u003e\n"],["\u003cp\u003eYou can determine if a budget is shared by querying the \u003ccode\u003ecampaign_budget.explicitly_shared\u003c/code\u003e field using GAQL.\u003c/p\u003e\n"]]],[],null,["# Sharing Campaign Budgets\n\nA budget can be applied to a single campaign, or be\n[shared](//support.google.com/google-ads/answer/2517512) across many campaigns.\n\nSetup\n-----\n\nWhen you [create](/google-ads/api/docs/campaigns/budgets/create-budgets) a new\n[`CampaignBudget`](/google-ads/api/reference/rpc/v21/CampaignBudget) using the Google Ads API, you can\nspecify if it is shareable with the\n[`BoolValue`](/protocol-buffers/docs/reference/google.protobuf#bool-value)\nof the\n[`explicitly_shared`](/google-ads/api/reference/rpc/v21/CampaignBudget#explicitly_shared)\nfield:\n\n- `true` (default): can be shared among multiple campaigns\n- `false`: can be used by only one campaign\n\n| **Key Point:** Once the budget is created, you cannot change `explicitly_shared` from `true` to `false`. However, you can change `explicitly_shared` from `false` to `true`, but only if there are no [experiments](//support.google.com/google-ads/answer/2385204) running on the campaign that's using the budget.\n\nExplicitly shared budgets appear in an account's **Shared Library** in the\nGoogle Ads UI, whereas a non-shared budget appears only within its associated\ncampaign's **Settings**.\n\nIn the following example where a new budget is created, the budget is shared\nbecause `explicitly_shared` is set to `true`.\n\n\n### Java\n\n```java\nprivate String createSharedCampaignBudget(GoogleAdsClient googleAdsClient, long customerId) {\n try (CampaignBudgetServiceClient campaignBudgetServiceClient =\n googleAdsClient.getLatestVersion().createCampaignBudgetServiceClient()) {\n // Creates a shared budget.\n CampaignBudget budget =\n CampaignBudget.newBuilder()\n .setName(\"Shared Interplanetary Budget #\" + getPrintableDateTime())\n .setAmountMicros(50_000_000L)\n .setDeliveryMethod(BudgetDeliveryMethod.STANDARD)\n .setExplicitlyShared(true)\n .build();\n // Constructs an operation that will create a shared budget.\n CampaignBudgetOperation operation =\n CampaignBudgetOperation.newBuilder().setCreate(budget).build();\n // Sends the operation in a mutate request.\n MutateCampaignBudgetsResponse response =\n campaignBudgetServiceClient.mutateCampaignBudgets(\n Long.toString(customerId), Lists.newArrayList(operation));\n\n MutateCampaignBudgetResult mutateCampaignBudgetResult = response.getResults(0);\n // Prints the resource name of the created object.\n System.out.printf(\n \"Created shared budget with resource name: '%s'.%n\",\n mutateCampaignBudgetResult.getResourceName());\n\n return mutateCampaignBudgetResult.getResourceName();\n }\n}https://github.com/googleads/google-ads-java/blob/3c3c1041c2a0ab81553e3b2a79876256649397ed/google-ads-examples/src/main/java/com/google/ads/googleads/examples/advancedoperations/UsePortfolioBiddingStrategy.java#L175-L202\n \n```\n\n### C#\n\n```c#\nprivate string CreateSharedBudget(GoogleAdsClient client, long customerId, string name,\n long amount)\n{\n // Get the CampaignBudgetService.\n CampaignBudgetServiceClient campaignBudgetService =\n client.GetService(Services.V21.CampaignBudgetService);\n\n // Create a shared budget.\n CampaignBudget budget = new CampaignBudget()\n {\n Name = name,\n AmountMicros = amount,\n DeliveryMethod = BudgetDeliveryMethodEnum.Types.BudgetDeliveryMethod.Standard,\n ExplicitlyShared = true\n };\n\n // Create the operation.\n CampaignBudgetOperation campaignBudgetOperation = new CampaignBudgetOperation()\n {\n Create = budget\n };\n\n // Make the mutate request.\n MutateCampaignBudgetsResponse retVal = campaignBudgetService.MutateCampaignBudgets(\n customerId.ToString(), new CampaignBudgetOperation[] { campaignBudgetOperation });\n return retVal.Results[0].ResourceName;\n}https://github.com/googleads/google-ads-dotnet/blob/ada966e1983b655e82172b6c3e7d9b091b522377/Google.Ads.GoogleAds/examples/AdvancedOperations/UsePortfolioBiddingStrategy.cs#L171-L197\n \n```\n\n### PHP\n\n```php\nprivate static function createSharedCampaignBudget(\n GoogleAdsClient $googleAdsClient,\n int $customerId\n) {\n // Creates a shared budget.\n $budget = new CampaignBudget([\n 'name' =\u003e 'Shared Interplanetary Budget #' . Helper::getPrintableDatetime(),\n 'delivery_method' =\u003e BudgetDeliveryMethod::STANDARD,\n // Sets the amount of budget.\n 'amount_micros' =\u003e 50000000,\n // Makes the budget explicitly shared.\n 'explicitly_shared' =\u003e true\n ]);\n\n // Constructs a campaign budget operation.\n $campaignBudgetOperation = new CampaignBudgetOperation();\n $campaignBudgetOperation-\u003esetCreate($budget);\n\n // Issues a mutate request to create the budget.\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(\n \"Created a shared budget with resource name '%s'.%s\",\n $addedBudget-\u003egetResourceName(),\n PHP_EOL\n );\n\n return $addedBudget-\u003egetResourceName();\n} \nhttps://github.com/googleads/google-ads-php/blob/be0249c30c27b4760387bec6682b82c9f4167761/examples/AdvancedOperations/UsePortfolioBiddingStrategy.php#L190-L223\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\ncampaign_budget.explicitly_shared = True\n\n# Add budget.\ntry:\n campaign_budget_response: MutateCampaignBudgetsResponse = (\n campaign_budget_service.mutate_campaign_budgets(\n customer_id=customer_id, operations=[campaign_budget_operation]\n )\n )\n campaign_budget_id: str = campaign_budget_response.results[\n 0\n ].resource_name\n print(f'Budget \"{campaign_budget_id}\" was created.')\nexcept GoogleAdsException as ex:\n handle_googleads_exception(ex)https://github.com/googleads/google-ads-python/blob/d0595698b8a7de6cc00684b467462601037c9db9/examples/advanced_operations/use_portfolio_bidding_strategy.py#L67-L91\n \n```\n\n### Ruby\n\n```ruby\n# Create a budget, which can be shared by multiple campaigns.\nbudget = client.resource.campaign_budget do |cb|\n cb.name = \"Interplanetary budget ##{(Time.new.to_f * 1000).to_i}\"\n cb.amount_micros = 50_000_000\n cb.delivery_method = :STANDARD\n cb.explicitly_shared = true\nend\n\noperation = client.operation.create_resource.campaign_budget(budget)\n\nresponse = client.service.campaign_budget.mutate_campaign_budgets(\n customer_id: customer_id,\n operations: [operation],\n)\nbudget_id = response.results.first.resource_name \nhttps://github.com/googleads/google-ads-ruby/blob/2752563c7ffd15a4d2238116869f64aea3011cc3/examples/advanced_operations/use_portfolio_bidding_strategy.rb#L31-L45\n\n \n```\n\n### Perl\n\n```perl\nsub create_shared_campaign_buget {\n my ($api_client, $customer_id) = @_;\n\n # Create a shared budget.\n my $campaign_budget =\n Google::Ads::GoogleAds::V21::Resources::CampaignBudget-\u003enew({\n name =\u003e \"Shared Interplanetary Budget #\" . uniqid(),\n deliveryMethod =\u003e STANDARD,\n # Set the amount of budget.\n amountMicros =\u003e 50000000,\n # Makes the budget explicitly shared.\n explicitlyShared =\u003e 'true'\n });\n\n # Create a campaign budget operation.\n my $campaign_budget_operation =\n Google::Ads::GoogleAds::V21::Services::CampaignBudgetService::CampaignBudgetOperation\n -\u003enew({create =\u003e $campaign_budget});\n\n # Add the campaign budget.\n my $campaign_budgets_response = $api_client-\u003eCampaignBudgetService()-\u003emutate({\n customerId =\u003e $customer_id,\n operations =\u003e [$campaign_budget_operation]});\n\n my $campaign_budget_resource_name =\n $campaign_budgets_response-\u003e{results}[0]{resourceName};\n\n printf \"Created a shared budget with resource name: '%s'.\\n\",\n $campaign_budget_resource_name;\n\n return $campaign_budget_resource_name;\n}https://github.com/googleads/google-ads-perl/blob/9abffd69cd856633dfdcee5c636fe9cd0eb4b5ed/examples/advanced_operations/use_portfolio_bidding_strategy.pl#L124-L155\n \n```\n\n\u003cbr /\u003e\n\nDetermine if a campaign budget is shared\n----------------------------------------\n\nYou can retrieve the budget setting value by searching for the\n[`campaign_budget.explicitly_shared`](/google-ads/api/fields/v21/campaign_budget#campaign_budget.explicitly_shared)\nfield. Here is the [GAQL](/google-ads/api/docs/query/overview) query for the field, filtering\non a budget ID: \n\n```sql\nSELECT campaign_budget.explicitly_shared\nFROM campaign_budget\nWHERE campaign_budget.id = campaign_budget_id\n```"]]