Les budgets de compte contrôlent les dépenses d'un compte sur une période donnée.
en définissant des propriétés de budget telles que la limite de dépense, l'heure de début et l'heure de fin. Ils
doit pointer vers l'une des configurations de facturation du compte, pour indiquer quelle
Le compte de paiement sera facturé. Vous pouvez créer, mettre à jour et supprimer
AccountBudget
en envoyant
Objets AccountBudgetProposal
.
Les objets AccountBudget
représentent le résultat final.
d'application des propositions. Une fois la proposition approuvée, ses modifications (sous réserve
d'ajustements) entraînera la création d'un nouveau budget de compte ou
par une mise à jour existante. Cela dépend
proposal_type
spécifiées dans la demande.
AccountBudgetProposalType |
Description |
---|---|
CREATE |
Crée un budget de compte, qui doit être approuvé avant utilisation. |
UPDATE |
Modifie un budget de compte existant. |
END |
Définit l'heure de fin d'un budget de compte sur l'heure actuelle. |
REMOVE |
Supprime un budget de compte avant son heure de début. |
Les sections ci-dessous décrivent le comportement de chaque type de proposition.
Créer une proposition de budget de compte
La création d'un budget de compte vous permet de contrôler les dépenses d'un client
et le comportement des consommateurs. Utilisez le
AccountBudgetProposalService
pour créer
AccountBudgetProposal
Vous devez définir
proposal_type
jusqu'à
CREATE
pour spécifier qu'un nouveau budget doit être créé. Consultez la
la gestion de ce guide pour les autres opérations.
N'oubliez pas d'utiliser une configuration de facturation avec un compte de paiement avec lequel vous avez y accéder. Consultez le guide de configuration de la facturation pour découvrir plus de détails.
L'exemple suivant montre comment créer une proposition de budget.
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.V17.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, customer_id, billing_setup_id): 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::V17::Resources::AccountBudgetProposal->new({ billingSetup => Google::Ads::GoogleAds::V17::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::V17::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; }
Dans les demandes de proposition
de budget de compte,
proposed_start_date_time
et
proposed_end_date_time
sont toujours dans le fuseau horaire du compte du client ; vous ne pouvez pas spécifier de fuseau horaire. La
limite de dépense proposée
est toujours mesurée dans la devise du compte ; spécifiez-le à l'aide de "micro" unités,
donc 1,00 $= 1 000 000 de micro-unités.
Vous pouvez éventuellement inclure un numéro de bon de commande qui s'affichera à côté de ces frais sur la facture. Cela n'a aucune incidence sur l'exécution du budget.
Supprimer une proposition de budget de compte en attente
Vous pouvez supprimer l'intégralité d'une proposition de budget en attente en envoyant une
AccountBudgetProposalOperation Remove
avec un nom de ressource de proposition de budget de compte. Notez toutefois
les propositions de budget sont
généralement appliquées en quelques minutes.
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::V17::Services::AccountBudgetProposalService::AccountBudgetProposalOperation ->new({ remove => Google::Ads::GoogleAds::V17::Utils::ResourceNames::billing_setup( $customer_id, $account_budget_proposal_id ) }); # Send request to Google Ads API (not shown).
Si vous vous êtes trompé concernant la proposition initiale, vous pouvez renvoyer la
la proposition en tant qu'opération UPDATE
. Consultez la
Gérer les budgets de compte existants ci-dessous.
Récupérer des budgets de compte existants
La requête GAQL suivante récupère tous les budgets existants d'un compte:
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
Notez que les champs qui incluent les heures de début, de fin et de fin du budget de compte
limite de dépense ont plusieurs variantes avec des préfixes tels que proposed
et
approved
permettant de comparer les valeurs initialement proposées avec
celles qui ont été approuvées. La limite de dépense comporte des champs supplémentaires avec le paramètre
Préfixe adjusted
pour indiquer le plafond budgétaire actuel en vigueur après le
ajustements ont été appliqués au montant approuvé.
La limite de dépense approuvée d'un budget de compte peut être ajustée au fil du temps pour : Ils reflètent des avoirs pour des éléments tels que les impressions excessives liées au budget ou les clics incorrects. les activités et les bons de réduction. Plus d'informations sur les budgets de compte et avoirs et ajustements du compte dans le centre d'aide Google Ads.
Tous les nouveaux budgets de compte en attente d'approbation, ainsi que les éventuels comptes existants
les budgets faisant l'objet de mises à jour en attente, contiennent également
Champ pending_proposal
que vous pouvez sélectionner. Il contiendra
l'ID de ressource
des AccountBudgetProposal
associés
.
Exemples de code
Le dossier Billing
de chaque bibliothèque cliente contient un exemple de code qui affiche une requête complète:
Gérer les budgets de compte existants
Après avoir créé un budget de compte pour un client, vous pouvez utiliser les
AccountBudgetProposalService
jusqu'à
gérer les paramètres budgétaires. Les opérations de gestion
les plus courantes sont
modifiez les champs spending_limit
et end_date_time
. Pour obtenir la liste complète
les champs modifiables, reportez-vous au
AccountBudgetProposal
document.
Vous avez la possibilité de mettre à jour le budget d'un compte existant ou de créer un un tout nouveau budget, voir les deux ici.
Modifier un budget de compte existant
Vous pouvez mettre à jour les champs existants du budget du compte en envoyant
des objets AccountBudgetProposal
avec
AccountBudgetProposalType
définie sur UPDATE
. Notez que vous devez également indiquer les champs mis à jour
l'argument UpdateMask
de l'opération.
L'extrait de code suivant montre comment modifier la limite de dépense proposée pour un budget de compte existant.
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::V17::Resources::AccountBudgetProposal->new({ proposalType => UPDATE, accountBudget => $account_budget->{resourceName}, proposedSpendingLimitMicros => $account_budget->{proposedSpendingLimitMicros} + $increaseAmount}); my $account_budget_proposal_operation = Google::Ads::GoogleAds::V17::Services::AccountBudgetProposalService::AccountBudgetProposalOperation ->new({ create => $account_budget_proposal, updateMask => all_set_fields_of($account_budget_proposal)}); # Send request to Google Ads API (not shown).
Association de budgets de compte
Au lieu de modifier le budget existant, Google Ads vous permet d'associer plusieurs budgets de compte à la suite. Dans l'exemple suivant, le client a des limites de dépense différentes chaque mois.
Pour ce faire, vous pouvez créer
des objets AccountBudgetProposal
et
en les redirigeant vers
AccountBudgetProposalService
L'extrait de code ci-dessous montre comment créer ce type de chaîne à l'aide d'un la configuration de la facturation.
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::V17::Resources::AccountBudgetProposal->new({ billingSetup => Google::Ads::GoogleAds::V17::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::V17::Resources::AccountBudgetProposal->new({ billingSetup => Google::Ads::GoogleAds::V17::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::V17::Resources::AccountBudgetProposal->new({ billingSetup => Google::Ads::GoogleAds::V17::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).
Notez l'utilisation
AccountBudgetProposalType.CREATE
pour chaque proposition. Cela créera trois budgets distincts, au lieu d'être mis à jour
trois fois le même budget.
Clôture des budgets de compte
Les budgets de compte peuvent être clôturés lorsqu'ils sont actifs et supprimés avant le ou en attente d'approbation.
Clôture du budget de compte actif
Impossible de supprimer le budget du compte actif. Vous pouvez toutefois définir l'heure de fin
à l'heure actuelle. Le moyen le plus simple d'y parvenir est
d'envoyer une proposition avec
AccountBudgetProposalType.END
L'extrait de code suivant montre comment clôturer un budget de compte existant.
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::V17::Resources::AccountBudgetProposal->new({ proposalType => END, accountBudget => $account_budget->{resourceName}); # Send request to Google Ads API (not shown).
Cela revient à modifier le budget d'un compte en définissant la date de fin
date et heure sur TimeType.NOW
.
Supprimer un budget de compte approuvé avant son heure de début
Si vous avez proposé de définir un budget de compte qui débute à une date ultérieure, vous pouvez supprimer
avant l'heure de début en envoyant une
AccountBudgetProposalType.REMOVE
type de proposition.
L'extrait de code suivant illustre la suppression d'un compte existant du budget.
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::V17::Resources::AccountBudgetProposal->new({ proposalType => REMOVE, accountBudget => $account_budget->{resourceName}); # Send request to Google Ads API (not shown).