بودجه حساب

بودجه‌های حساب با تعریف ویژگی‌های بودجه مانند محدودیت هزینه، زمان شروع و زمان پایان، میزان هزینه‌ای که یک حساب می‌تواند در یک دوره زمانی خاص خرج کند را کنترل می‌کنند. آن‌ها باید به یکی از تنظیمات صورتحساب حساب اشاره کنند تا مشخص شود که کدام حساب پرداخت خاص، صورتحساب خواهد شد. شما می‌توانید با ارسال اشیاء AccountBudgetProposal ، AccountBudget ایجاد، به‌روزرسانی و حذف کنید.

اشیاء AccountBudget نتیجه نهایی اعمال پیشنهادها را نشان می‌دهند. پس از تأیید یک پیشنهاد، تغییرات آن (با توجه به هرگونه تنظیمات) منجر به ایجاد یک بودجه حساب جدید یا به‌روزرسانی یک بودجه حساب موجود خواهد شد. این بستگی به proposal_type مشخص شده در درخواست دارد.

AccountBudgetProposalType توضیحات
CREATE یک بودجه حساب جدید ایجاد می‌کند که قبل از استفاده باید تأیید شود.
UPDATE بودجه حساب موجود را اصلاح می‌کند.
END زمان پایان بودجه حساب را به زمان فعلی تنظیم می‌کند.
REMOVE بودجه حساب را قبل از زمان شروع آن حذف می‌کند.

بخش‌های زیر رفتار هر نوع پیشنهاد را شرح می‌دهند.

ایجاد پیشنهاد بودجه حساب

ایجاد یک بودجه حساب جدید به شما امکان می‌دهد رفتار خرج کردن مشتری را کنترل کنید. از AccountBudgetProposalService برای ایجاد یک AccountBudgetProposal جدید استفاده کنید. برای تعیین اینکه بودجه جدیدی باید ایجاد شود، باید proposal_type روی CREATE تنظیم کنید. برای سایر عملیات به بخش مدیریت این راهنما مراجعه کنید.

به یاد داشته باشید که از تنظیمات صورتحساب با حساب پرداختی که در آن دسترسی نوشتن دارید استفاده کنید. برای جزئیات بیشتر به راهنمای تنظیمات صورتحساب مراجعه کنید.

مثال زیر نحوه ایجاد یک پیشنهاد بودجه جدید را نشان می‌دهد.

جاوا

private void runExample(GoogleAdsClient googleAdsClient, long customerId, long billingSetupId) {
  // Creates an AccountBudgetProposal. This will be reviewed offline by Google Ads, and if
  // approved will become an AccountBudget.
  AccountBudgetProposal proposal =
      AccountBudgetProposal.newBuilder()
          .setBillingSetup(ResourceNames.billingSetup(customerId, billingSetupId))
          .setProposalType(AccountBudgetProposalType.CREATE)
          .setProposedName("Account Budget (example)")

          // Specifies the account budget starts immediately.
          .setProposedStartTimeType(TimeType.NOW)
          // Alternatively you can specify a specific start time. Refer to the
          // AccountBudgetProposal
          // resource documentation for allowed formats.
          //
          // .setProposedStartDateTime("2020-01-02 03:04:05")

          // Specifies that the budget runs forever.
          .setProposedEndTimeType(TimeType.FOREVER)
          // Alternatively you can specify a specific end time. Allowed formats are as above.
          // .setProposedEndDateTime("2021-02-03 04:05:06")

          // Optional: sets notes for the budget. These are free text and do not effect budget
          // delivery.
          // .setProposedNotes("Received prepayment of $0.01")

          // Sets the spending limit to 0.01, measured in the Google Ads account currency.
          .setProposedSpendingLimitMicros(10_000)

          // Optional: sets PO number for record keeping. This value is at the user's
          // discretion, and has no effect on Google Billing & Payments.
          // .setProposedPurchaseOrderNumber("PO number 12345")
          .build();

  // Creates an operation which will add the new AccountBudgetProposal.
  AccountBudgetProposalOperation operation =
      AccountBudgetProposalOperation.newBuilder().setCreate(proposal).build();

  try (AccountBudgetProposalServiceClient accountBudgetProposalServiceClient =
      googleAdsClient.getLatestVersion().createAccountBudgetProposalServiceClient()) {
    // Sends the request to the Account Budget Proposal Service.
    MutateAccountBudgetProposalResponse response =
        accountBudgetProposalServiceClient.mutateAccountBudgetProposal(
            String.valueOf(customerId), operation);

    System.out.printf(
        "Account budget proposal created: %s.%n", response.getResult().getResourceName());
  }
}
      

سی شارپ

public void Run(GoogleAdsClient client, long customerId, long billingSetupId)
{
    // Get the AccountBudgetProposalServiceClient.
    AccountBudgetProposalServiceClient proposalService =
        client.GetService(Services.V22.AccountBudgetProposalService);

    // Create an AccountBudgetProposal. The proposal will be reviewed offline by Google Ads,
    // and if approved will become an AccountBudget.
    AccountBudgetProposal proposal = new AccountBudgetProposal()
    {
        BillingSetup = ResourceNames.BillingSetup(customerId, billingSetupId),
        ProposalType = AccountBudgetProposalType.Create,
        ProposedName = "Account Budget (example)",

        // Specify the account budget starts immediately
        ProposedStartTimeType = TimeType.Now,
        // Alternatively, you can specify a specific start time. Refer to the
        // AccountBudgetProposal resource documentation for allowed formats.
        //
        //ProposedStartDateTime = "2020-01-02 03:04:05",

        // Specify that the budget runs forever.
        ProposedEndTimeType = TimeType.Forever,
        // Alternatively you can specify a specific end time. Allowed formats are as above.
        //ProposedEndDateTime = "2021-02-03 04:05:06",

        // Optional: set notes for the budget. These are free text and do not effect budget
        // delivery.
        //ProposedNotes = "Received prepayment of $0.01",

        // Set the spending limit to 0.01, measured in the Google Ads account currency.
        ProposedSpendingLimitMicros = 10_000

        // Optional: set PO number for record keeping. This value is at the user's
        // discretion, and has no effect on Google Billing & Payments.
        //ProposedPurchaseOrderNumber = "PO number 12345"
    };

    // Create an operation which will add the new AccountBudgetProposal
    AccountBudgetProposalOperation operation = new AccountBudgetProposalOperation()
    {
        Create = proposal
    };

    try
    {
        // Send the request to the Account Budget Proposal Service.
        MutateAccountBudgetProposalResponse response = proposalService.
            MutateAccountBudgetProposal(customerId.ToString(), operation);

        // Display the results.
        Console.WriteLine($"Account budget proposal '{response.Result.ResourceName}' " +
            "was created.");
    }
    catch (GoogleAdsException e)
    {
        Console.WriteLine("Failure:");
        Console.WriteLine($"Message: {e.Message}");
        Console.WriteLine($"Failure: {e.Failure}");
        Console.WriteLine($"Request ID: {e.RequestId}");
        throw;
    }
}
      

پی اچ پی

public static function runExample(
    GoogleAdsClient $googleAdsClient,
    int $customerId,
    int $billingSetupId
) {
    // Constructs an account budget proposal.
    $accountBudgetProposal = new AccountBudgetProposal([
        'billing_setup' => ResourceNames::forBillingSetup($customerId, $billingSetupId),
        'proposal_type' => AccountBudgetProposalType::CREATE,
        'proposed_name' => 'Account Budget (example)',
        // Specifies the account budget starts immediately.
        'proposed_start_time_type' => TimeType::NOW,
        // Alternatively you can specify a specific start time. Refer to the
        // AccountBudgetProposal class for allowed formats.
        //
        // 'proposed_start_date_time' => '2020-01-02 03:04:05',

        // Specify that the budget runs forever.
        'proposed_end_time_type' => TimeType::FOREVER,
        // Alternatively you can specify a specific end time. Allowed formats are as above.
        // 'proposed_end_date_time' => '2021-02-03 04:05:06',

        // Optional: set notes for the budget. These are free text and do not effect budget
        // delivery.
        // 'proposed_notes' => 'Received prepayment of $0.01',

        // Optional: set PO number for record keeping. This value is at the user's
        // discretion, and has no effect on Google Billing & Payments.
        // 'proposed_purchase_order_number' => 'PO number 12345',

        // Set the spending limit to 0.01, measured in the Google Ads account currency.
        'proposed_spending_limit_micros' => 10000
    ]);

    $accountBudgetProposalOperation = new AccountBudgetProposalOperation();
    $accountBudgetProposalOperation->setCreate($accountBudgetProposal);

    // Issues a mutate request to add the account budget proposal.
    $accountBudgetProposalServiceClient =
        $googleAdsClient->getAccountBudgetProposalServiceClient();
    $response = $accountBudgetProposalServiceClient->mutateAccountBudgetProposal(
        MutateAccountBudgetProposalRequest::build($customerId, $accountBudgetProposalOperation)
    );

    printf(
        "Added an account budget proposal with resource name '%s'.%s",
        $response->getResult()->getResourceName(),
        PHP_EOL
    );
}
      

پایتون

def main(client: GoogleAdsClient, customer_id: str, billing_setup_id: str):
    account_budget_proposal_service = client.get_service(
        "AccountBudgetProposalService"
    )
    billing_setup_service = client.get_service("BillingSetupService")

    account_budget_proposal_operation = client.get_type(
        "AccountBudgetProposalOperation"
    )
    proposal = account_budget_proposal_operation.create

    proposal.proposal_type = client.enums.AccountBudgetProposalTypeEnum.CREATE
    proposal.billing_setup = billing_setup_service.billing_setup_path(
        customer_id, billing_setup_id
    )
    proposal.proposed_name = "Account Budget Proposal (example)"

    # Specify the account budget starts immediately
    proposal.proposed_start_time_type = client.enums.TimeTypeEnum.NOW
    # Alternatively you can specify a specific start time. Refer to the
    # AccountBudgetProposal resource documentation for allowed formats.
    #
    # proposal.proposed_start_date_time = '2020-01-02 03:04:05'

    # Specify that the budget runs forever
    proposal.proposed_end_time_type = client.enums.TimeTypeEnum.FOREVER
    # Alternatively you can specify a specific end time. Allowed formats are as
    # above.
    #
    # proposal.proposed_end_date_time = '2021-01-02 03:04:05'

    # Optional: set notes for the budget. These are free text and do not effect
    # budget delivery.
    #
    # proposal.proposed_notes = 'Received prepayment of $0.01'
    proposal.proposed_spending_limit_micros = 10000

    account_budget_proposal_response = (
        account_budget_proposal_service.mutate_account_budget_proposal(
            customer_id=customer_id,
            operation=account_budget_proposal_operation,
        )
    )
    print(
        "Created account budget proposal "
        f'"{account_budget_proposal_response.result.resource_name}".'
    )
      

روبی

def add_account_budget_proposal(customer_id, billing_setup_id)
  # GoogleAdsClient will read a config file from
  # ENV['HOME']/google_ads_config.rb when called without parameters
  client = Google::Ads::GoogleAds::GoogleAdsClient.new


  operation = client.operation.create_resource.account_budget_proposal do |proposal|
    proposal.billing_setup = client.path.billing_setup(customer_id, billing_setup_id)
    proposal.proposal_type = :CREATE
    proposal.proposed_name = 'Account Budget (example)'

    # Specify the account budget starts immediately
    proposal.proposed_start_time_type = :NOW
    # Alternatively you can specify a specific start time. Refer to the
    # AccountBudgetProposal resource documentation for allowed formats.
    #
    # proposal.proposed_start_date_time = '2020-01-02 03:04:05'

    # Specify that the budget runs forever.
    proposal.proposed_end_time_type = :FOREVER
    # Alternatively you can specify a specific end time. Allowed formats are as
    # above.
    #
    # proposal.proposed_end_date_time = '2021-01-02 03:04:05'

    # Optional: set notes for the budget. These are free text and do not affect
    # budget delivery.
    #
    # proposal.proposed_notes = 'Received prepayment of $0.01'

    # Set the spending limit to 0.01, measured in the Google Ads account currency.
    proposal.proposed_spending_limit_micros = 10_000
  end

  account_budget_proposal_service = client.service.account_budget_proposal
  # Add budget proposal.
  response = account_budget_proposal_service.mutate_account_budget_proposal(
    customer_id: customer_id,
    operation: operation,
  )

  puts sprintf("Created budget proposal %s.",
      response.results.first.resource_name)
end
      

پرل

sub add_account_budget_proposal {
  my ($api_client, $customer_id, $billing_setup_id) = @_;

  # Create an account budget proposal.
  my $account_budget_proposal =
    Google::Ads::GoogleAds::V22::Resources::AccountBudgetProposal->new({
      billingSetup =>
        Google::Ads::GoogleAds::V22::Utils::ResourceNames::billing_setup(
        $customer_id, $billing_setup_id
        ),
      proposalType => CREATE,
      proposedName => "Account Budget (example)",
      # Specify that the account budget starts immediately.
      proposedStartTimeType => NOW,
      # Alternatively you can specify a specific start time. Refer to the
      # AccountBudgetProposal class for allowed formats.
      #
      # proposedStartDateTime => "2020-01-02 03:04:05",

      # Specify that the account budget runs forever.
      proposedEndDateTime => FOREVER,
      # Alternatively you can specify a specific end time. Allowed formats are as below.
      # proposedEndDateTime => "2021-02-03 04:05:06",

      # Optional: set notes for the budget. These are free text and do not effect budget
      # delivery.
      # proposedNotes => "Received prepayment of $0.01",

      # Optional: set PO number for record keeping. This value is at the user's
      # discretion, and has no effect on Google Billing & Payments.
      # proposedPurchaseOrderNumber => "PO number 12345",

      # Set the spending limit to 0.01, measured in the Google Ads account currency.
      proposedSpendingLimitMicros => 10000
    });

  # Create an account budget proposal operation.
  my $account_budget_proposal_operation =
    Google::Ads::GoogleAds::V22::Services::AccountBudgetProposalService::AccountBudgetProposalOperation
    ->new({
      create => $account_budget_proposal
    });

  # Add the account budget proposal.
  my $account_budget_proposal_response =
    $api_client->AccountBudgetProposalService()->mutate({
      customerId => $customer_id,
      operation  => $account_budget_proposal_operation
    });

  printf "Created account budget proposal '%s'.\n",
    $account_budget_proposal_response->{result}{resourceName};

  return 1;
}
      

در درخواست‌های پیشنهاد بودجه حساب، proposed_start_date_time و proposed_end_date_time همیشه در منطقه زمانی حساب مشتری هستند؛ شما نمی‌توانید منطقه زمانی مشخص کنید. محدودیت هزینه پیشنهادی همیشه با واحد پول حساب اندازه‌گیری می‌شود؛ این را با استفاده از واحدهای "میکرو" مشخص کنید، بنابراین ۱.۰۰ دلار = ۱,۰۰۰,۰۰۰ میکرو.

به صورت اختیاری، می‌توانید یک شماره سفارش خرید اضافه کنید که در کنار این هزینه‌ها در فاکتور نمایش داده می‌شود. این هیچ تاثیری بر تحویل بودجه ندارد.

حذف پیشنهاد بودجه حساب در حال بررسی

شما می‌توانید با ارسال درخواست AccountBudgetProposalOperation Remove به همراه نام منبع پیشنهاد بودجه حساب، کل یک پیشنهاد بودجه در حال بررسی را حذف کنید. با این حال، توجه داشته باشید که پیشنهادهای بودجه معمولاً ظرف چند دقیقه اعمال می‌شوند.

جاوا
AccountBudgetProposalOperation operation = AccountBudgetProposalOperation.newBuilder()
  .setRemove(StringValue.of(ResourceNames.accountBudgetProposal(customerId, accountBudgetProposalId)))
  .build();

// Send request to Google Ads API (not shown).
سی شارپ
AccountBudgetProposalOperation operation = new AccountBudgetProposalOperation()
{
    Remove = ResourceNames.AccountBudgetProposal(customerId, accountBudgetProposalId)
};

// Send request to Google Ads API (not shown).
پی اچ پی
$accountBudgetProposalOperation = new AccountBudgetProposalOperation();
$accountBudgetProposalOperation->setRemove(ResourceNames::forAccountBudgetProposal($customerId, $accountBudgetProposalId));

// Send request to Google Ads API (not shown).
پایتون
account_budget_proposal_service = client.get_service('AccountBudgetProposalService')
account_budget_proposal_operation = client.get_type('AccountBudgetProposalOperation')
proposal = account_budget_proposal_operation.remove
proposal.resource_name = account_budget_proposal_service.account_budget_proposal_path(customer_id, account_budget_proposal_id):

# Send request to Google Ads API (not shown).
روبی
operation = client.operation.remove_resource.account_budget_proposal(client.path.account_budget_proposal(customer_id, account_budget_proposal_id))

# Send request to Google Ads API (not shown).
پرل
my $account_budget_proposal_operation =
  Google::Ads::GoogleAds::V22::Services::AccountBudgetProposalService::AccountBudgetProposalOperation
    ->new({
      remove => Google::Ads::GoogleAds::V22::Utils::ResourceNames::billing_setup(
          $customer_id, $account_budget_proposal_id
        )
    });

# Send request to Google Ads API (not shown).

اگر در پیشنهاد اولیه اشتباه کردید، می‌توانید پیشنهاد را به عنوان یک عملیات UPDATE دوباره ارسال کنید. به به‌روزرسانی بودجه حساب موجود مراجعه کنید.

بودجه‌های حساب موجود را بازیابی کنید

کوئری GAQL زیر تمام بودجه‌های حساب‌های موجود در یک حساب را واکشی می‌کند:

SELECT
  account_budget.status,
  account_budget.billing_setup,
  account_budget.approved_spending_limit_micros,
  account_budget.approved_spending_limit_type,
  account_budget.proposed_spending_limit_micros,
  account_budget.proposed_spending_limit_type,
  account_budget.adjusted_spending_limit_micros,
  account_budget.adjusted_spending_limit_type,
  account_budget.approved_start_date_time,
  account_budget.proposed_start_date_time,
  account_budget.approved_end_date_time,
  account_budget.approved_end_time_type,
  account_budget.proposed_end_date_time,
  account_budget.proposed_end_time_type
FROM
  account_budget

فیلدهایی که زمان شروع، زمان پایان و محدودیت هزینه بودجه حساب را در بر می‌گیرند، انواع مختلفی با پیشوندهایی مانند proposed و approved دارند که امکان مقایسه مقادیری را که در ابتدا پیشنهاد شده‌اند با مقادیری که تأیید شده‌اند، فراهم می‌کنند. محدودیت هزینه دارای فیلدهای اضافی با پیشوند adjusted تا محدودیت هزینه فعلی را که پس از اعمال هرگونه تعدیل در مبلغ تأیید شده اعمال می‌شود، نشان دهد.

محدودیت هزینه مصوب بودجه حساب کاربری را می‌توان به مرور زمان تنظیم کرد تا اعتبارات مختلفی را برای مواردی مانند تحویل بیش از حد بودجه، فعالیت کلیک نامعتبر و کوپن‌های تبلیغاتی منعکس کند. اطلاعات بیشتر در مورد بودجه حساب کاربری و اعتبارات و تنظیمات حساب کاربری را می‌توانید در مرکز راهنمای تبلیغات گوگل (Google Ads) بیابید.

هر بودجه حساب جدید که در انتظار تأیید است، به همراه هر بودجه حساب موجود که به‌روزرسانی‌های آن در انتظار تأیید است، حاوی یک فیلد pending_proposal نیز خواهد بود که می‌توان آن را انتخاب کرد. این فیلد شامل شناسه منبع شیء AccountBudgetProposal مرتبط خواهد بود.

مدیریت بودجه حساب‌های موجود

پس از ایجاد بودجه حساب برای مشتری، می‌توانید از AccountBudgetProposalService برای مدیریت پارامترهای بودجه استفاده کنید. رایج‌ترین عملیات مدیریتی، به‌روزرسانی فیلدهای spending_limit و end_date_time است. برای مشاهده لیست کاملی از فیلدهای قابل تغییر، به سند AccountBudgetProposal مراجعه کنید.

شما می‌توانید بودجه حساب موجود را به‌روزرسانی کنید یا یک بودجه کاملاً جدید ایجاد کنید، هر دو در اینجا نشان داده شده‌اند.

بودجه حساب موجود را به‌روزرسانی کنید

شما می‌توانید فیلدهای بودجه حساب موجود را با ارسال اشیاء AccountBudgetProposal با AccountBudgetProposalType تنظیم شده روی UPDATE به‌روزرسانی کنید. توجه داشته باشید که باید فیلدهایی را که به‌روزرسانی می‌شوند در آرگومان UpdateMask عملیات نیز مشخص کنید.

قطعه کد زیر نحوه به‌روزرسانی محدودیت هزینه پیشنهادی برای بودجه حساب موجود را نشان می‌دهد.

جاوا
AccountBudgetProposal proposal = AccountBudgetProposal.newBuilder()
  .setProposalType(AccountBudgetProposalType.UPDATE)
  .setAccountBudget(accountBudget.getResourceName())
  .setProposedSpendingLimitMicros(
    accountBudget.getProposedSpendingLimitMicros().getValue() + increaseAmount)
  .build();

AccountBudgetProposalOperation operation = AccountBudgetProposalOperation.newBuilder()
  .setCreate(proposal)
  .setUpdateMask(
      FieldMask.newBuilder().addAllPaths(Arrays.asList("proposed_spending_limit")).build())
  .build();

// Send request to Google Ads API (not shown).
سی شارپ
AccountBudgetProposal proposal = new AccountBudgetProposal()
{
  ProposalType = AccountBudgetProposalType.Update,
  AccountBudget = accountBudget.ResourceName,
  ProposedSpendingLimitMicros = accountBudget.ProposedSpendingLimitMicros + increaseAmount
};

AccountBudgetProposalOperation operation = new AccountBudgetProposalOperation()
{
  Create = proposal,
  UpdateMask = new FieldMask()
  {
    Paths = { "proposed_spending_limit" }
  }
};

// Send request to Google Ads API (not shown).
پی اچ پی
$accountBudgetProposal = new AccountBudgetProposal([
  'proposal_type' => AccountBudgetProposalType::UPDATE,
  'account_budget' => $accountBudget->getResourceName(),
  'proposed_spending_limit_micros' =>
    $accountBudget->getProposedSpendingLimitMicros() + $increaseAmount])

$accountBudgetProposalOperation = new AccountBudgetProposalOperation();
$accountBudgetProposalOperation->setCreate($accountBudgetProposal);
$accountBudgetProposalOperation->setUpdateMask(
  FieldMasks::allSetFieldsOf($accountBudgetProposal)
);

// Send request to Google Ads API (not shown).
پایتون
account_budget_proposal_operation = client.get_type('AccountBudgetProposalOperation')

proposal = account_budget_proposal_operation.create
proposal.proposal_type = client.get_type('AccountBudgetProposalTypeEnum').UPDATE
proposal.account_budget = account_budget
proposal.proposed_spending_limit_micros = account_budget.proposed_spending_limit_micros + increase_amount

field_mask = protobuf_helpers.field_mask(None, proposal)
account_budget_proposal_operation.update_mask.CopyFrom(field_mask)

# Send request to Google Ads API (not shown).
روبی
proposal = client.resource.account_budget_proposal
proposal.proposal_type = :UPDATE

mask = client.field_mask.with proposal do
  proposal.account_budget = account_budget.resource_name
  proposal.proposed_spending_limit_micros = account_budget.proposed_spending_limit_micros + increase_amount
end

operation = client.operation.account_budget_proposal do |op|
  op.create = proposal
  op.update_mask = mask
end

# Send request to Google Ads API (not shown).
پرل
my $account_budget_proposal =
  Google::Ads::GoogleAds::V22::Resources::AccountBudgetProposal->new({
    proposalType => UPDATE,
    accountBudget => $account_budget->{resourceName},
    proposedSpendingLimitMicros => $account_budget->{proposedSpendingLimitMicros} + $increaseAmount});

my $account_budget_proposal_operation =
  Google::Ads::GoogleAds::V22::Services::AccountBudgetProposalService::AccountBudgetProposalOperation
    ->new({
      create => $account_budget_proposal,
      updateMask => all_set_fields_of($account_budget_proposal)});

# Send request to Google Ads API (not shown).

زنجیره بودجه حساب

به عنوان جایگزینی برای به‌روزرسانی بودجه موجود، گوگل ادز به شما امکان می‌دهد بودجه‌های چندین حساب کاربری را به صورت زنجیره‌ای و پشت سر هم اجرا کنید. در مثال زیر، یک مشتری هر ماه محدودیت‌های هزینه متفاوتی دارد.

نموداری که زنجیره‌ای از بودجه‌های حساب را با محدودیت‌های هزینه مختلف در هر ماه نشان می‌دهد.
مثالی از زنجیره سازی بودجه حساب.

این کار را می‌توان با ایجاد سه شیء AccountBudgetProposal و ارسال آنها به AccountBudgetProposalService انجام داد.

قطعه کد زیر ایجاد چنین زنجیره‌ای را با استفاده از تنظیمات صورتحساب موجود نشان می‌دهد.

جاوا
AccountBudgetProposal proposalMay = AccountBudgetProposal.newBuilder()
  .setBillingSetup(ResourceNames.billingSetup(customerId, billingSetupId))
  .setProposalType(AccountBudgetProposalType.CREATE)
  .setProposedName("May budget")
  .setProposedStartDateTime("2018-05-01")
  .setProposedEndDateTime("2018-06-01")
  .setProposedSpendingLimitMicros(1_000_000_000L)
  .build();

AccountBudgetProposal proposalJune = AccountBudgetProposal.newBuilder()
  .setBillingSetup(ResourceNames.billingSetup(customerId, billingSetupId))
  .setProposalType(AccountBudgetProposalType.CREATE)
  .setProposedName("June budget")
  .setProposedStartDateTime("2018-06-01")
  .setProposedEndDateTime("2018-07-01")
  .setProposedSpendingLimitMicros(5_000_000_000L)
  .build();

AccountBudgetProposal proposalJuly = AccountBudgetProposal.newBuilder()
  .setBillingSetup(ResourceNames.billingSetup(customerId, billingSetupId))
  .setProposalType(AccountBudgetProposalType.CREATE)
  .setProposedName("July budget")
  .setProposedStartDateTime("2018-07-01")
  .setProposedEndDateTime("2018-08-01")
  .setProposedSpendingLimitMicros(1_000_000_000L)
  .build();

// Send request to Google Ads API (not shown).
سی شارپ
AccountBudgetProposal proposalMay = new AccountBudgetProposal()
{
  BillingSetup = ResourceNames.BillingSetup(customerId, billingSetupId),
  ProposalType = AccountBudgetProposalType.Create,
  ProposedName = "May budget",
  ProposedStartDateTime = "2018-05-01",
  ProposedEndDateTime = "2018-06-01",
  ProposedSpendingLimitMicros = 1_000_000_000
}

AccountBudgetProposal proposalJune = new AccountBudgetProposal()
{
  BillingSetup = ResourceNames.BillingSetup(customerId, billingSetupId),
  ProposalType = AccountBudgetProposalType.Create,
  ProposedName = "June budget",
  ProposedStartDateTime = "2018-06-01",
  ProposedEndDateTime = "2018-07-01",
  ProposedSpendingLimitMicros = 5_000_000_000
}

AccountBudgetProposal proposalJuly = new AccountBudgetProposal()
{
  BillingSetup = ResourceNames.BillingSetup(customerId, billingSetupId),
  ProposalType = AccountBudgetProposalType.Create,
  ProposedName = "July budget",
  ProposedStartDateTime = "2018-07-01",
  ProposedEndDateTime = "2018-08-01",
  ProposedSpendingLimitMicros = 1_000_000_000
}

// Send request to Google Ads API (not shown).
پی اچ پی
$proposalMay = new AccountBudgetProposal([
  'billing_setup' => ResourceNames::forBillingSetup($customerId, $billingSetupId),
  'proposal_type' => AccountBudgetProposalType::CREATE,
  'proposed_name' => 'May budget',
  'proposed_start_date_time' => '2018-05-01',
  'proposed_end_date_time' => '2018-06-01',
  'proposed_spending_limit_micros' => 1000000000
]);

$proposalJune = new AccountBudgetProposal([
  'billing_setup' => ResourceNames::forBillingSetup($customerId, $billingSetupId),
  'proposal_type' => AccountBudgetProposalType::CREATE,
  'proposed_name' => 'June budget',
  'proposed_start_date_time' => '2018-06-01',
  'proposed_end_date_time' => '2018-07-01',
  'proposed_spending_limit_micros' => 5000000000
]);

$proposalJuly = new AccountBudgetProposal([
  'billing_setup' => ResourceNames::forBillingSetup($customerId, $billingSetupId),
  'proposal_type' => AccountBudgetProposalType::CREATE,
  'proposed_name' => 'July budget',
  'proposed_start_date_time' => '2018-07-01',
  'proposed_end_date_time' => '2018-08-01',
  'proposed_spending_limit_micros' => 1000000000
]);

// Send request to Google Ads API (not shown).
پایتون
may_account_budget_proposal_operation = client.get_type('AccountBudgetProposalOperation')
proposalMay = may_account_budget_proposal_operation.create
proposalMay.proposal_type = client.get_type('AccountBudgetProposalTypeEnum').CREATE
proposalMay.billing_setup = billing_setup_service.billing_setup_path(customer_id, billing_setup_id)
proposalMay.proposed_name = 'May budget'
proposalMay.proposed_start_date_time = '2018-05-01'
proposalMay.proposed_end_date_time = '2018-06-01'
proposalMay.proposed_spending_limit_micros = 1000000000

june_account_budget_proposal_operation = client.get_type('AccountBudgetProposalOperation')
proposalJune = may_account_budget_proposal_operation.create
proposalJune.proposal_type = client.get_type('AccountBudgetProposalTypeEnum').CREATE
proposalJune.billing_setup = billing_setup_service.billing_setup_path(customer_id, billing_setup_id)
proposalJune.proposed_name = 'June budget'
proposalJune.proposed_start_date_time = '2018-06-01'
proposalJune.proposed_end_date_time = '2018-07-01'
proposalJune.proposed_spending_limit_micros = 5000000000

july_account_budget_proposal_operation = client.get_type('AccountBudgetProposalOperation')
proposalJuly = may_account_budget_proposal_operation.create
proposalJuly.proposal_type = client.get_type('AccountBudgetProposalTypeEnum').CREATE
proposalJuly.billing_setup = billing_setup_service.billing_setup_path(customer_id, billing_setup_id)
proposalJuly.proposed_name = 'July budget'
proposalJuly.proposed_start_date_time = '2018-07-01'
proposalJuly.proposed_end_date_time = '2018-08-01'
proposalJuly.proposed_spending_limit_micros = 1000000000

# Send request to Google Ads API (not shown).
روبی
proposal_may = client.operation.create_resource.account_budget_proposal do |proposal|
  proposal.billing_setup = client.path.billing_setup(customer_id, billing_setup_id)
  proposal.proposal_type = :CREATE
  proposal.proposed_name = 'May budget'
  proposal.proposed_start_date_time = '2018-05-01'
  proposal.proposed_end_date_time = '2018-06-01'
  proposal.proposed_spending_limit_micros = 1_000_000_000
end

proposal_june = client.operation.create_resource.account_budget_proposal do |proposal|
  proposal.billing_setup = client.path.billing_setup(customer_id, billing_setup_id)
  proposal.proposal_type = :CREATE
  proposal.proposed_name = 'June budget'
  proposal.proposed_start_date_time = '2018-06-01'
  proposal.proposed_end_date_time = '2018-07-01'
  proposal.proposed_spending_limit_micros = 5_000_000_000
end

proposal_july = client.operation.create_resource.account_budget_proposal do |proposal|
  proposal.billing_setup = client.path.billing_setup(customer_id, billing_setup_id)
  proposal.proposal_type = :CREATE
  proposal.proposed_name = 'July budget'
  proposal.proposed_start_date_time = '2018-07-01'
  proposal.proposed_end_date_time = '2018-08-01'
  proposal.proposed_spending_limit_micros = 1_000_000_000
end

# Send request to Google Ads API (not shown).
پرل
my $may_proposal =
  Google::Ads::GoogleAds::V22::Resources::AccountBudgetProposal->new({
    billingSetup =>
      Google::Ads::GoogleAds::V22::Utils::ResourceNames::billing_setup(
      $customer_id, $billing_setup_id
      ),
    proposalType => CREATE,
    proposedName => "May budget",
    proposedStartDateTime => "2018-05-01",
    proposedEndDateTime => "2018-06-01",
    proposedSpendingLimitMicros => 1000000000
  });

my $june_proposal =
  Google::Ads::GoogleAds::V22::Resources::AccountBudgetProposal->new({
    billingSetup =>
      Google::Ads::GoogleAds::V22::Utils::ResourceNames::billing_setup(
      $customer_id, $billing_setup_id
      ),
    proposalType => CREATE,
    proposedName => "June budget",
    proposedStartDateTime => "2018-06-01",
    proposedEndDateTime => "2018-07-01",
    proposedSpendingLimitMicros => 5000000000
  });

my $july_proposal =
  Google::Ads::GoogleAds::V22::Resources::AccountBudgetProposal->new({
    billingSetup =>
      Google::Ads::GoogleAds::V22::Utils::ResourceNames::billing_setup(
      $customer_id, $billing_setup_id
      ),
    proposalType => CREATE,
    proposedName => "July budget",
    proposedStartDateTime => "2018-07-01",
    proposedEndDateTime => "2018-08-01",
    proposedSpendingLimitMicros => 1000000000
  });

# Send request to Google Ads API (not shown).

به استفاده از AccountBudgetProposalType.CREATE در هر پیشنهاد توجه کنید. این کار به جای اینکه یک بودجه را سه بار به‌روزرسانی کند، سه بودجه مجزا ایجاد می‌کند.

بودجه‌های حساب را خاتمه دهید

بودجه‌بندی حساب‌ها می‌تواند در حالت فعال خاتمه یابد و قبل از شروع یا در انتظار تأیید، به‌طور کامل حذف شود.

بودجه حساب فعال را پایان دهید

بودجه فعال حساب قابل حذف نیست. با این حال، می‌توانید زمان پایان را روی زمان فعلی تنظیم کنید. ساده‌ترین راه برای دستیابی به این هدف، ارسال پیشنهاد با AccountBudgetProposalType.END است.

قطعه کد زیر نحوه پایان دادن به بودجه حساب موجود را نشان می‌دهد.

جاوا
AccountBudgetProposal.newBuilder()
  .setProposalType(AccountBudgetProposalType.END)
  .setAccountBudget(accountBudget.getResourceName())
  .build();

// Send request to Google Ads API (not shown).
سی شارپ
AccountBudgetProposal proposal = new AccountBudgetProposal()
{
  ProposalType = AccountBudgetProposalType.End,
  AccountBudget = accountBudget.ResourceName
};

// Send request to Google Ads API (not shown).
پی اچ پی
$accountBudgetProposal = new AccountBudgetProposal([
  'proposal_type' => AccountBudgetProposalType::END,
  'account_budget' => $accountBudget->getResourceName()
])

// Send request to Google Ads API (not shown).
پایتون
account_budget_proposal_operation = client.get_type('AccountBudgetProposalOperation')
proposal = account_budget_proposal_operation.create
proposal.proposal_type = client.get_type('AccountBudgetProposalTypeEnum').END
proposal.account_budget = account_budget

# Send request to Google Ads API (not shown).
روبی
proposal = client.resource.account_budget_proposal
proposal.proposal_type = :END
proposal.account_budget = account_budget.resource_name

# Send request to Google Ads API (not shown).
پرل
my $account_budget_proposal =
  Google::Ads::GoogleAds::V22::Resources::AccountBudgetProposal->new({
    proposalType => END,
    accountBudget => $account_budget->{resourceName});

# Send request to Google Ads API (not shown).

این معادل تنظیم به‌روزرسانی بودجه یک حساب با تنظیم زمان تاریخ پایان به TimeType.NOW است.

حذف بودجه حساب تایید شده قبل از زمان شروع آن

اگر بودجه‌بندی حسابی را برای شروع در آینده پیشنهاد کرده‌اید، می‌توانید قبل از زمان شروع، با ارسال نوع پیشنهاد AccountBudgetProposalType.REMOVE ، آن را به‌طور کامل حذف کنید.

قطعه کد زیر حذف بودجه حساب آینده موجود را نشان می‌دهد.

جاوا
AccountBudgetProposal.newBuilder()
  .setProposalType(AccountBudgetProposalType.REMOVE)
  .setAccountBudget(accountBudget.getResourceName())
  .build();

// Send request to Google Ads API (not shown).
سی شارپ
AccountBudgetProposal proposal = new AccountBudgetProposal()
{
  ProposalType = AccountBudgetProposalType.Remove,
  AccountBudget = accountBudget.ResourceName
};

// Send request to Google Ads API (not shown).
پی اچ پی
$accountBudgetProposal = new AccountBudgetProposal([
  'proposal_type' => AccountBudgetProposalType::REMOVE,
  'account_budget' => $accountBudget->getResourceName()
])

// Send request to Google Ads API (not shown).
پایتون
account_budget_proposal_operation = client.get_type('AccountBudgetProposalOperation')
proposal = account_budget_proposal_operation.create
proposal.proposal_type = client.get_type('AccountBudgetProposalTypeEnum').REMOVE
proposal.account_budget = account_budget

# Send request to Google Ads API (not shown).
روبی
proposal = client.resource.account_budget_proposal
proposal.proposal_type = :REMOVE
proposal.account_budget = account_budget.resource_name

# Send request to Google Ads API (not shown).
پرل
my $account_budget_proposal =
  Google::Ads::GoogleAds::V22::Resources::AccountBudgetProposal->new({
    proposalType => REMOVE,
    accountBudget => $account_budget->{resourceName});

# Send request to Google Ads API (not shown).