Contact Us

Google Ads Scripts Part 2

Getting Started with Google Ads Scripts – Part 2

In the previous post on Google Ads Scripts we looked at a script to manage spending called “budget stopper” to switch off a campaign if it is reaching its monthly budget. This script is useful because it keeps a running total of that months spend, and at a level you decide you can’t spend over, it will pause your designated campaigns.

To set it up, we headed over to Google ads > Tools > Bulk actions > Scripts, and then uploaded the code. After this we set the spend limit, name our label, created and attached our label to the accounts campaigns we wanted this to work on, tested it, and finally set the frequency the script would run to hourly.

It’s important to remember that Ad Scripts only run in the account that you add them too, even if you have identical scripts and labels in other accounts.

Next, we would like to automatically start the campaign at the beginning of the next monthly billing cycle.

So we create a new script which we have called budget starter, and pasted in the following code, changing the Start_Cost value and changing the line campaign.pause();

we changed to



if(AdsApp.currentAccount().getStatsFor(“THIS_MONTH”).getCost() > START_COST) {

we changed to

if(AdsApp.currentAccount().getStatsFor(“THIS_MONTH”).getCost() < START_COST) { (we simply changed the > to <).

So, here’s what that script looks like;








var START_COST = 10;
var START_LABEL = “Auto Stop”;

function main() {
var label = AdsApp.labels().withCondition(“Name='” + START_LABEL + “‘”).get().next();
if(AdsApp.currentAccount().getStatsFor(“THIS_MONTH”).getCost() < START_COST) {
var campaignIterator = label.campaigns().get();

while (campaignIterator.hasNext()) {
var campaign =;

So, if the the account has spent less than £1000 (START_COST) that month, when the script runs it will take any campaign with the label added to it (START_LABEL) which has the name “Auto Stop”, and will switch it on.
We are using the same label as with the Budget Stopper script, so we kept the name as before. If the monthly spend is over a given level, it will switch off, and likewise if under a certain level, switch the campaign with that label on.
This we don’t need to set more often than daily, so select in the Frequency column as shown below, Daily, and I have gone with 1am. This means at the beginning of each month, the campaigns will switch back on.










You should now have automated the account to not exceed your monthly budget, and run automatically when under that budget. As you can see there are many things that can be done, and it can extend to many other tasks and actions. You can change ad groups, switch keywords on or off, or change bids.

Advanced implementations even can pull in weather data.

If you need any help with your digital campaign strategy, please contact us today.


This article was posted by

Leave a Reply

What our clients say

"It’s like having your own in-house digital marketing consultancy rather than an external company. I no longer think about them as a supplier. They’re part of the team."
Marketing Manager, Education
"They have always been professional and focused on delivering results in a timely and cost effective manner. It is enlightening to have an organisation that takes the time to make recommendations on actual data analysis."
Business Manager, Charity
"They (Network Intellect) continue to exhibit their digital expertise by helping us to establish a competitive advantage by pushing the boundaries and innovating their technology and performance solutions."
Head of Marketing Communications, Education
"Because of their talent, expertise and level of service our on-line business has increased dramatically."
Founder, Electronics
"I would have no hesitation in recommending them as an analytics partner to understand and improve the performance of a website."
Vice President, Retail
Network Intellect continue to give us a fantastic service, fast and friendly and are always ready to go the extra mile. They have gone above and beyond the call of duty to deliver our results.
Director, E-Cigarette Web
"We found that Network Intellect had the depth of knowledge we needed and after speaking to them a few times we decided to go with them. It’s the best decision we’ve made in some time."
Owner, Retail
"Their services offered great value for money. I would not hesitate to recommend them as a digital partner to others."
Strategic Marketing Manager, Education
"Jason and his team at Network Intellect embody efficiency and efficacy. I would have no hesitation in recommending this excellent company to others."
Marketing Manager, Education
Network Intellect have managed our product data feeds with exceptional care and meticulous detail. I know I can trust them to make the right decisions for our business."
Director, E-Commerce
"It’s like having your own in-house digital marketing consultancy rather than an external company. I no longer think about them as a supplier. They’re part of the team."
Marketing Manager, Education
Read all testimonialsRead all testimonials

We can help you be great

We have friendly staff ready to help you get on your path to greatness...
Network Intellect Menu