Budget Orders

Retrieve base spending limit of budget order

function getBaseSpendingLimit() {
  var budgetOrderIterator = AdWordsApp.budgetOrders().get();
  while (budgetOrderIterator.hasNext()) {
    var budgetOrder = budgetOrderIterator.next();
    var limitText = "";
    if (budgetOrder.getSpendingLimit() == null) {
      limitText = "unlimited";
    } else if (budgetOrder.getTotalAdjustments() == null) {
      limitText = budgetOrder.getSpendingLimit();
    } else {
      limitText = budgetOrder.getSpendingLimit() -
          budgetOrder.getTotalAdjustments();
    }
    Logger.log("Budget Order [" + budgetOrder.getName() +
        "] base spending limit: " + limitText);
}

Retrieve the active budget order

function getActiveBudgetOrder() {
  // There will only be one active budget order at any given time.
  var budgetOrderIterator = AdWordsApp.budgetOrders()
      .withCondition('status="ACTIVE"')
      .get();
  while (budgetOrderIterator.hasNext()) {
    var budgetOrder = budgetOrderIterator.next();
    Logger.log("Budget Order [" + budgetOrder.getName() +
        "] is currently active.");
  }
}

Retrieve all budget orders

function getAllBudgetOrders() {
  var budgetOrderIterator = AdWordsApp.budgetOrders().get();
  while (budgetOrderIterator.hasNext()) {
    var budgetOrder = budgetOrderIterator.next();
    Logger.log("Budget Order [" + budgetOrder.getName() + "]");
  }
}

发送以下问题的反馈:

此网页
AdWords Scripts
AdWords Scripts
需要帮助?请访问我们的支持页面