תקציבי חשבון

תקציבי חשבון מאפשרים לקבוע את סכום ההוצאות בחשבון במהלך תקופת זמן מסוימת, על ידי הגדרת מאפייני תקציב כמו מגבלת הוצאות, שעת התחלה ושעת סיום. הם צריכים להפנות לאחת מהגדרות החיוב של החשבון, כדי לציין איזה חשבון תשלומים ספציפי יחויב. אפשר ליצור, לעדכן ולהסיר את התג AccountBudget ב-Google Ads API על ידי שליחת אובייקטים של AccountBudgetProposal.

אובייקטים מסוג AccountBudget מייצגים את התוצאה הסופית של יישום ההצעות. אחרי שהצעה מאושרת, השינויים שבה (בכפוף לכל התאמה) יובילו ליצירת תקציב חשבון חדש או לעדכון של תקציב קיים. זה תלוי בproposal_type שצוין בבקשה.

AccountBudgetProposalType תיאור
CREATE יוצר תקציב חדש לחשבון, שצריך לקבל אישור לפני שמשתמשים בו.
UPDATE שינוי תקציב קיים בחשבון.
END הפעולה מגדירה את מועד הסיום של תקציב החשבון לזמן הנוכחי.
REMOVE הסרת תקציב חשבון לפני שעת ההתחלה שלו.

בקטעים הבאים מתואר אופן הפעולה של כל סוג של הצעה.

יצירת הצעה לתקציב החשבון

יצירת תקציב חדש לחשבון מאפשרת לכם לשלוט בהתנהגות ההוצאות של הלקוח. משתמשים ב-AccountBudgetProposalService כדי ליצור AccountBudgetProposal חדש. כדי לציין שצריך ליצור תקציב חדש, צריך להגדיר את proposal_type לערך CREATE. בקטע ניהול במדריך הזה מפורטות פעולות נוספות.

חשוב להשתמש בהגדרת חיוב עם חשבון תשלומים שיש לכם גישת כתיבה אליו. פרטים נוספים זמינים במדריך להגדרת החיוב.

בדוגמה הבאה אפשר לראות איך יוצרים הצעת תקציב חדשה.

Java

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());
  }
}
      

C#‎

public void Run(GoogleAdsClient client, long customerId, long billingSetupId)
{
    // Get the AccountBudgetProposalServiceClient.
    AccountBudgetProposalServiceClient proposalService =
        client.GetService(Services.V25.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;
    }
}
      

PHP

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
    );
}
      

Python

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}".'
    )
      

Ruby

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
      

Perl

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::V25::Resources::AccountBudgetProposal->new({
      billingSetup =>
        Google::Ads::GoogleAds::V25::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::V25::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;
}
      

curl

בבקשות להצעות לתקציב החשבון, הערכים proposed_start_date_time ו-proposed_end_date_time תמיד מוצגים באזור הזמן של חשבון הלקוח, ואי אפשר לציין אזור זמן. תקרת ההוצאות המוצעת נמדדת תמיד במטבע של החשבון. צריך לציין אותה ביחידות מיקרו, כך ש-1.00 $‎ = 1,000,000 מיקרו.

אפשר גם לכלול מספר הזמנת רכש שיופיע ליד החיובים האלה בחשבונית. השינוי הזה לא משפיע על ניהול התקציב.

הסרה של הצעה לתקציב חשבון בהמתנה

כדי להסיר הצעה שלמה לתקציב בהמתנה, שולחים בקשת AccountBudgetProposalOperation.remove עם שם משאב של הצעה לתקציב החשבון. עם זאת, חשוב לזכור שהצעות לתקציב מתעדכנות בדרך כלל תוך כמה דקות.

Java
AccountBudgetProposalOperation operation = AccountBudgetProposalOperation.newBuilder()
  .setRemove(ResourceNames.accountBudgetProposal(customerId, accountBudgetProposalId))
  .build();

// Send request to Google Ads API (not shown).
C#
AccountBudgetProposalOperation operation = new AccountBudgetProposalOperation()
{
    Remove = ResourceNames.AccountBudgetProposal(customerId, accountBudgetProposalId)
};

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

// Send request to Google Ads API (not shown).
Python
account_budget_proposal_service = client.get_service('AccountBudgetProposalService')
account_budget_proposal_operation = client.get_type('AccountBudgetProposalOperation')
account_budget_proposal_operation.remove = (
    account_budget_proposal_service.account_budget_proposal_path(
        customer_id, account_budget_proposal_id
    )
)

# Send request to Google Ads API (not shown).
Ruby
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).
Perl
my $account_budget_proposal_operation =
  Google::Ads::GoogleAds::V25::Services::AccountBudgetProposalService::AccountBudgetProposalOperation
    ->new({
      remove => Google::Ads::GoogleAds::V25::Utils::ResourceNames::account_budget_proposal(
          $customer_id, $account_budget_proposal_id
        )
    });

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

אם עשיתם טעות בהצעה המקורית, אתם יכולים לשלוח אותה מחדש כפעולת UPDATE. אפשר לעיין במאמר בנושא עדכון תקציב קיים בחשבון.

אחזור של תקציבים קיימים בחשבון

שאילתת Google Ads Query Language ‏ (GAQL) הבאה מאחזרת את כל התקציבים הקיימים בחשבון:

SELECT
  account_budget.resource_name,
  account_budget.id,
  account_budget.name,
  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, שניתן לבחור את שדות המשנה שלה בשאילתת GAQL (למשל account_budget_proposal, שמוגדרת כשאילתה כ-account_budget.pending_proposal.account_budget_proposal, עבור שם המשאב של אובייקט AccountBudgetProposal המשויך).

ניהול תקציבים קיימים בחשבון

אחרי שיוצרים תקציב לחשבון של לקוח, אפשר להשתמש בלחצן AccountBudgetProposalService כדי לנהל את פרמטרים של התקציב. הפעולות הניהוליות הנפוצות ביותר הן עדכון השדות proposed_spending_limit_micros ו-proposed_end_date_time. רשימה מלאה של השדות שניתנים לשינוי מופיעה במאמרי העזרה בנושא AccountBudgetProposal.

יש לכם אפשרות לעדכן תקציב קיים בחשבון או ליצור תקציב חדש לגמרי. שתי האפשרויות מוצגות כאן.

עדכון תקציב קיים בחשבון

כדי לעדכן את השדות הקיימים של תקציב החשבון, שולחים אובייקטים מסוג AccountBudgetProposal עם הערך UPDATE בשדה AccountBudgetProposalType. חשוב לדעת שצריך לציין את השדות שמעדכנים גם בupdate_maskארגומנט של הפעולה.

בקטע הקוד הבא אפשר לראות איך מעדכנים את מגבלת ההוצאות המוצעת בתקציב קיים בחשבון.

Java
AccountBudgetProposal proposal = AccountBudgetProposal.newBuilder()
  .setProposalType(AccountBudgetProposalType.UPDATE)
  .setAccountBudget(accountBudget.getResourceName())
  .setProposedSpendingLimitMicros(
    accountBudget.getProposedSpendingLimitMicros() + increaseAmount)
  .build();

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

// Send request to Google Ads API (not shown).
C#
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_micros" }
  }
};

// Send request to Google Ads API (not shown).
PHP
$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).
Python
account_budget_proposal_operation = client.get_type('AccountBudgetProposalOperation')

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

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

# Send request to Google Ads API (not shown).
Ruby
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).
Perl
my $account_budget_proposal =
  Google::Ads::GoogleAds::V25::Resources::AccountBudgetProposal->new({
    proposalType => UPDATE,
    accountBudget => $account_budget->{resourceName},
    proposedSpendingLimitMicros => $account_budget->{proposedSpendingLimitMicros} + $increaseAmount});

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

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

שרשור של תקציבי חשבון

במקום לעדכן את התקציב הקיים, אפשר ב-Google Ads לשרשר כמה תקציבים בחשבון כך שהם יפעלו ברצף. בדוגמה הבאה, ללקוח יש תקרות הוצאות שונות בכל חודש.

דיאגרמה שבה מוצגת שרשרת של תקציבי חשבון עם תקרות הוצאות שונות בכל חודש.
דוגמה לשרשור של תקציבים בחשבון.

כדי לעשות את זה, צריך ליצור שלושה אובייקטים AccountBudgetProposal ולשלוח כל אחד מהם AccountBudgetProposalOperation אל AccountBudgetProposalService בבקשת MutateAccountBudgetProposal נפרדת (כי MutateAccountBudgetProposalRequest מקבל רק operation אחד לכל קריאה).

בקטע הקוד הבא אפשר לראות איך יוצרים שרשרת כזו באמצעות הגדרת חיוב קיימת.

Java
AccountBudgetProposal proposalMay = AccountBudgetProposal.newBuilder()
  .setBillingSetup(ResourceNames.billingSetup(customerId, billingSetupId))
  .setProposalType(AccountBudgetProposalType.CREATE)
  .setProposedName("May budget")
  .setProposedStartDateTime("2027-05-01 00:00:00")
  .setProposedEndDateTime("2027-06-01 00:00:00")
  .setProposedSpendingLimitMicros(1_000_000_000L)
  .build();

AccountBudgetProposalOperation operationMay = AccountBudgetProposalOperation.newBuilder()
  .setCreate(proposalMay)
  .build();

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

AccountBudgetProposalOperation operationJune = AccountBudgetProposalOperation.newBuilder()
  .setCreate(proposalJune)
  .build();

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

AccountBudgetProposalOperation operationJuly = AccountBudgetProposalOperation.newBuilder()
  .setCreate(proposalJuly)
  .build();

// Send requests to Google Ads API, one MutateAccountBudgetProposal call per operation (not shown).
C#
AccountBudgetProposal proposalMay = new AccountBudgetProposal()
{
  BillingSetup = ResourceNames.BillingSetup(customerId, billingSetupId),
  ProposalType = AccountBudgetProposalType.Create,
  ProposedName = "May budget",
  ProposedStartDateTime = "2027-05-01 00:00:00",
  ProposedEndDateTime = "2027-06-01 00:00:00",
  ProposedSpendingLimitMicros = 1_000_000_000
};

AccountBudgetProposalOperation operationMay = new AccountBudgetProposalOperation()
{
  Create = proposalMay
};

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

AccountBudgetProposalOperation operationJune = new AccountBudgetProposalOperation()
{
  Create = proposalJune
};

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

AccountBudgetProposalOperation operationJuly = new AccountBudgetProposalOperation()
{
  Create = proposalJuly
};

// Send requests to Google Ads API, one MutateAccountBudgetProposal call per operation (not shown).
PHP
$proposalMay = new AccountBudgetProposal([
  'billing_setup' => ResourceNames::forBillingSetup($customerId, $billingSetupId),
  'proposal_type' => AccountBudgetProposalType::CREATE,
  'proposed_name' => 'May budget',
  'proposed_start_date_time' => '2027-05-01 00:00:00',
  'proposed_end_date_time' => '2027-06-01 00:00:00',
  'proposed_spending_limit_micros' => 1000000000
]);
$operationMay = new AccountBudgetProposalOperation();
$operationMay->setCreate($proposalMay);

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

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

// Send requests to Google Ads API, one MutateAccountBudgetProposal call per operation (not shown).
Python
billing_setup_service = client.get_service('BillingSetupService')

may_account_budget_proposal_operation = client.get_type('AccountBudgetProposalOperation')
proposal_may = may_account_budget_proposal_operation.create
proposal_may.proposal_type = client.get_type('AccountBudgetProposalTypeEnum').AccountBudgetProposalType.CREATE
proposal_may.billing_setup = billing_setup_service.billing_setup_path(customer_id, billing_setup_id)
proposal_may.proposed_name = 'May budget'
proposal_may.proposed_start_date_time = '2027-05-01 00:00:00'
proposal_may.proposed_end_date_time = '2027-06-01 00:00:00'
proposal_may.proposed_spending_limit_micros = 1000000000

june_account_budget_proposal_operation = client.get_type('AccountBudgetProposalOperation')
proposal_june = june_account_budget_proposal_operation.create
proposal_june.proposal_type = client.get_type('AccountBudgetProposalTypeEnum').AccountBudgetProposalType.CREATE
proposal_june.billing_setup = billing_setup_service.billing_setup_path(customer_id, billing_setup_id)
proposal_june.proposed_name = 'June budget'
proposal_june.proposed_start_date_time = '2027-06-01 00:00:00'
proposal_june.proposed_end_date_time = '2027-07-01 00:00:00'
proposal_june.proposed_spending_limit_micros = 5000000000

july_account_budget_proposal_operation = client.get_type('AccountBudgetProposalOperation')
proposal_july = july_account_budget_proposal_operation.create
proposal_july.proposal_type = client.get_type('AccountBudgetProposalTypeEnum').AccountBudgetProposalType.CREATE
proposal_july.billing_setup = billing_setup_service.billing_setup_path(customer_id, billing_setup_id)
proposal_july.proposed_name = 'July budget'
proposal_july.proposed_start_date_time = '2027-07-01 00:00:00'
proposal_july.proposed_end_date_time = '2027-08-01 00:00:00'
proposal_july.proposed_spending_limit_micros = 1000000000

# Send requests to Google Ads API, one MutateAccountBudgetProposal call per operation (not shown).
Ruby
operation_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 = '2027-05-01 00:00:00'
  proposal.proposed_end_date_time = '2027-06-01 00:00:00'
  proposal.proposed_spending_limit_micros = 1_000_000_000
end

operation_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 = '2027-06-01 00:00:00'
  proposal.proposed_end_date_time = '2027-07-01 00:00:00'
  proposal.proposed_spending_limit_micros = 5_000_000_000
end

operation_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 = '2027-07-01 00:00:00'
  proposal.proposed_end_date_time = '2027-08-01 00:00:00'
  proposal.proposed_spending_limit_micros = 1_000_000_000
end

# Send requests to Google Ads API, one MutateAccountBudgetProposal call per operation (not shown).
Perl
my $may_proposal =
  Google::Ads::GoogleAds::V25::Resources::AccountBudgetProposal->new({
    billingSetup =>
      Google::Ads::GoogleAds::V25::Utils::ResourceNames::billing_setup(
      $customer_id, $billing_setup_id
      ),
    proposalType => CREATE,
    proposedName => "May budget",
    proposedStartDateTime => "2027-05-01 00:00:00",
    proposedEndDateTime => "2027-06-01 00:00:00",
    proposedSpendingLimitMicros => 1000000000
  });
my $may_operation =
  Google::Ads::GoogleAds::V25::Services::AccountBudgetProposalService::AccountBudgetProposalOperation
    ->new({create => $may_proposal});

my $june_proposal =
  Google::Ads::GoogleAds::V25::Resources::AccountBudgetProposal->new({
    billingSetup =>
      Google::Ads::GoogleAds::V25::Utils::ResourceNames::billing_setup(
      $customer_id, $billing_setup_id
      ),
    proposalType => CREATE,
    proposedName => "June budget",
    proposedStartDateTime => "2027-06-01 00:00:00",
    proposedEndDateTime => "2027-07-01 00:00:00",
    proposedSpendingLimitMicros => 5000000000
  });
my $june_operation =
  Google::Ads::GoogleAds::V25::Services::AccountBudgetProposalService::AccountBudgetProposalOperation
    ->new({create => $june_proposal});

my $july_proposal =
  Google::Ads::GoogleAds::V25::Resources::AccountBudgetProposal->new({
    billingSetup =>
      Google::Ads::GoogleAds::V25::Utils::ResourceNames::billing_setup(
      $customer_id, $billing_setup_id
      ),
    proposalType => CREATE,
    proposedName => "July budget",
    proposedStartDateTime => "2027-07-01 00:00:00",
    proposedEndDateTime => "2027-08-01 00:00:00",
    proposedSpendingLimitMicros => 1000000000
  });
my $july_operation =
  Google::Ads::GoogleAds::V25::Services::AccountBudgetProposalService::AccountBudgetProposalOperation
    ->new({create => $july_proposal});

# Send requests to Google Ads API, one MutateAccountBudgetProposal call per operation (not shown).

שימו לב לשימוש ב-AccountBudgetProposalType.CREATE בכל הצעה. כך ייצרו שלושה תקציבים נפרדים, ולא יעדכנו את אותו תקציב שלוש פעמים.

סגירה של תקציבים בחשבון

אפשר להפסיק תקציבים בחשבון כשהם פעילים, ולהסיר אותם לגמרי לפני שהם מתחילים או בזמן שהם בהמתנה לאישור.

סיום תקציב החשבון הפעיל

אי אפשר להסיר את תקציב החשבון הפעיל. עם זאת, אפשר להגדיר את שעת הסיום לשעה הנוכחית. הדרך הכי פשוטה לעשות את זה היא לשלוח הצעה עם AccountBudgetProposalType.END.

בקטע הקוד הבא אפשר לראות איך מסיימים תקציב קיים בחשבון.

Java
AccountBudgetProposal proposal = AccountBudgetProposal.newBuilder()
  .setProposalType(AccountBudgetProposalType.END)
  .setAccountBudget(accountBudget.getResourceName())
  .build();

AccountBudgetProposalOperation operation = AccountBudgetProposalOperation.newBuilder()
  .setCreate(proposal)
  .build();

// Send request to Google Ads API (not shown).
C#
AccountBudgetProposal proposal = new AccountBudgetProposal()
{
  ProposalType = AccountBudgetProposalType.End,
  AccountBudget = accountBudget.ResourceName
};

AccountBudgetProposalOperation operation = new AccountBudgetProposalOperation()
{
  Create = proposal
};

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

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

// Send request to Google Ads API (not shown).
Python
account_budget_proposal_operation = client.get_type('AccountBudgetProposalOperation')
proposal = account_budget_proposal_operation.create
proposal.proposal_type = client.get_type('AccountBudgetProposalTypeEnum').AccountBudgetProposalType.END
proposal.account_budget = account_budget.resource_name

# Send request to Google Ads API (not shown).
Ruby
operation = client.operation.create_resource.account_budget_proposal do |proposal|
  proposal.proposal_type = :END
  proposal.account_budget = account_budget.resource_name
end

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

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

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

הפעולה הזו שוות ערך לעדכון תקציב החשבון על ידי הגדרת שעת סיום התקציב ל-TimeType.NOW.

הסרה של תקציב החשבון מאושר לפני שעת ההתחלה שלו

אם הצעתם תקציב לחשבון שיתחיל בעתיד, אתם יכולים להסיר אותו לגמרי לפני שעת ההתחלה. לשם כך, צריך לשלוח הצעה מסוג AccountBudgetProposalType.REMOVE.

בקטע הקוד הבא מוצגת הסרה של תקציב קיים לחשבון עתידי.

Java
AccountBudgetProposal proposal = AccountBudgetProposal.newBuilder()
  .setProposalType(AccountBudgetProposalType.REMOVE)
  .setAccountBudget(accountBudget.getResourceName())
  .build();

AccountBudgetProposalOperation operation = AccountBudgetProposalOperation.newBuilder()
  .setCreate(proposal)
  .build();

// Send request to Google Ads API (not shown).
C#
AccountBudgetProposal proposal = new AccountBudgetProposal()
{
  ProposalType = AccountBudgetProposalType.Remove,
  AccountBudget = accountBudget.ResourceName
};

AccountBudgetProposalOperation operation = new AccountBudgetProposalOperation()
{
  Create = proposal
};

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

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

// Send request to Google Ads API (not shown).
Python
account_budget_proposal_operation = client.get_type('AccountBudgetProposalOperation')
proposal = account_budget_proposal_operation.create
proposal.proposal_type = client.get_type('AccountBudgetProposalTypeEnum').AccountBudgetProposalType.REMOVE
proposal.account_budget = account_budget.resource_name

# Send request to Google Ads API (not shown).
Ruby
operation = client.operation.create_resource.account_budget_proposal do |proposal|
  proposal.proposal_type = :REMOVE
  proposal.account_budget = account_budget.resource_name
end

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

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

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