How You Can Control Your Account Balance in AdWords Using Script

Probably, you have heard that a PPC campaign can easily exceed your initial budget and stop unpredictably when you do not expect this to happen. Indeed, marketers along with PPC specialists should control advertising budgets and understand when their accounts require replenishment. The solution we offer involves using JavaScript. Just show it to your PPC specialist and control your account balance with ease.

Some details first. In April 2017, AdWords Scripts has started to support a new feature, BudgetOrder. It allowed you to get information about your account’s budget limits, credit budgets, and other useful data related to your account replenishment. More updates from about using AdWords Scripts are to be released soon, as our colleagues report from Adwords Scripts Workshop.

This update facilitates the work of PPC specialists because they can calculate the account balance in advance, thereby avoiding account downtime. This is especially important if you replenish an account with a money order in a bank when the transfer can take a few days.

Got tired of low conversions?

Our certificated experts know how to optimise your Google AdWords campaigns so that conversions increase by 35%

By clicking this button you agree to our terms & conditions

The balance is calculated from the budget limit of the account itself. The system deducts campaign expenses for the entire time period from a number of all replenishments of the account, considering the funds that AdWords returned for invalid activities. As a result, you get more accurate account balance, as compared with the standard interface, because the money is withdrawn in parts during the day, not instantly.

The following script is written to control the balance of the budget. Basic settings of the script include:

  • • Limit is a minimum balance of funds that you want to be notified about.
  • • Days are a number of days before the completion of the balance that you want to be notified about.
  • • Alert-type allows selecting a limit value or a remainder or a number of days.
  • • IncludeVAT means that VAT is included in the accounts. VAT is charged at the end of the month and it is important to take into account when controlling the budget.

The script:

function main() {
  
  //Script settings 
  var days = 7; // A minimal number of days before the notification is sent
  var alertLimit = 1000; // A minimal budget when the notification is sent
  var email = [‘[email protected]]; // Adding emails of people who will receive the notification
  var alertType = true; // true – notification about a low budget with the value false – when a number of days is
  var includeVAT = true;
 
  var budgetOrder = AdWordsApp.budgetOrders().get().next();
  var SpendingLimit = budgetOrder.getSpendingLimit(); // General account limit
  var adjustments = budgetOrder.getTotalAdjustments(); // Refunds to the account
  
  var Spent = AdWordsApp.currentAccount().getStatsFor('ALL_TIME').getCost(); // Expenditure for the entire time period
  var lastWeekSpent = AdWordsApp.currentAccount().getStatsFor('LAST_7_DAYS').getCost(); // Expenditure for the last 7 days
  var thisMonthSpent = AdWordsApp.currentAccount().getStatsFor('THIS_MONTH').getCost();
  var vat = thisMonthSpent * 0.2;
  
  if (includeVAT) {
    SpendingLimit -= vat;
  }
  Logger.log(vat);
  
  if (adjustments == null) {
    var remainingBudget = SpendingLimit - Spent;
  } else {
    var remainingBudget = SpendingLimit - (Spent + adjustments);
  }
  Logger.log("Account balance - " + Math.round(remainingBudget));
  if (alertType) {
    if (remainingBudget < alertLimit) {
      sendSimpleTextEmail(email);
    }
  } else {
    
    var limitsDays = remainingBudget / lastWeekSpent;
    if (limitsDays < days) {
      sendSimpleTextEmail(email);
    }
  }

  function sendSimpleTextEmail(mail) {
    MailApp.sendEmail( mail,
                      'Minimum budget balance! ' + AdWordsApp.currentAccount().getName(),
                      'Your account is running low. Make a payment!');    
  }
}

Script settings are easy to apply. Remember that this script should be run at the account level, not the Client’s Center. It is also recommended to use the script in accounts without a credit line because there is a difference in the method of balance calculation.

Use this script and get the most of your PPC campaigns!

If you need a more complex solution, do not hesitate to contact us anytime.

1
Leave a Reply

avatar
1 Comment threads
0 Thread replies
1 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Emiliano Diminutto Rouan Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Emiliano Diminutto Rouan
Guest
Emiliano Diminutto Rouan

Hi Dmytro, thanx man! That’s very usefull to avoid verifiying manually the account balance.
I’d like to know how can I add into the email body the “Current Balance”
¡Many thanx!

Recent posts

How to develop an effective content strategy for a blog of a home decor store

May 20, 2020

Blogging is a comprehensive and affordable content marketing tool for eСommerce businesses. It helps to grow organic traffic on an eСommerce website and save money on advertising. In this article, we’ll tell more and try to add some non-obvious reasons to the ones mentioned in the sentence above, and share our ideas on how to Continue reading >

Marketing Tips for Real Estate Websites

May 13, 2020

The estate agent market is a highly competitive niche which looks much like a battlefield, where companies are fighting to conquer every potential client. How to build an effective marketing strategy and what to start with, if you are only planning to enter this market – Kirill Dubinin, Overseas SEO Specialist from Promodo shares the Continue reading >

Customer Loyalty Program for eCommerce business: 10 popular myths debunked

May 6, 2020

In this article, we dare shed the light on the most popular stereotypes and beliefs that envelop what marketers call “a good eCommerce loyalty strategy”. We’ll talk about how much customer loyalty really costs when measured by time, efforts, mistakes, and of course money.  For our customer loyalty research to be fair and truthful, we Continue reading >

What happens to eCommerce in quarantine: 240 companies surveyed

April 30, 2020

Traditional patterns and consumption habits have rapidly and radically changed in less than a couple of months. Companies rushed to strengthen their digital competencies, cut budgets, and rewrite the habitual scenarios. It seems like the world of ecommerce will never be the same after the COVID-19 pandemic. As a digital marketing agency, Promodo focuses mostly Continue reading >

Let's get the ball rolling

Please fill in this short form and we will be in touch with you soon

For any questions [email protected]

UK | USA | EST

+44 (0) 20 313 766 81
+44 7852 537715

Lincoln
The Terrace AT5,
Grantham Street,
LN2 1BD

+1 347 809 34 86

Las Vegas
6920 S. CIMARRON RD.,
Suite 100,
NV 89113

Tallinn
Roosikrantsi 2-K230,
Kesklinna linnaosa,
Harju maakond,
Tallinn 10119

CEE Ecommerce Report 2019

Based on the analytics data of 292 websites

enter correct name, please
enter correct e-mail, please
PPC

How You Can Control Your Account Balance in AdWords Using Script

1
start now

Start now