Connect with us


Google Ad Script to Manage Campaign Budgets



Today as advertisers utilizing Google Ads, it is a universal struggle to manage to a specific budget by campaign(s). Your options in the U.I. are singular: set a rule that excludes hourly. My question is why? Would it not be great to have a script to manage at the campaign level, via a sheet in 2019? It took some time but I figured it out, which you will see below. The ability to manage budgets in a single script with a sheet across multiple campaigns.

Before we continue onto the script, if you are set on rules not to say they are not great for budget management, here is an example of how to create a rule that has time setting limitations to pause or enable your campaigns based on a budget for campaigns. You can find additional details here with automated rules.

  1. Sign in to your Google Ads account.
  2. Go to the CampaignsAd Groups, or Keywords pages.
  3. Click the 3-dot icon above the statistics table.
  4. Select Create an automated rule.
  5. Select Pause or Enable from the “Type of rule” drop-down.
  6. Choose which Campaign Type
  7. To add a condition, click +ADD, under “Condition”.
  8. Define the frequency of your rule which is Once, Daily, Weekly or Monthly.
  9. Choose the type of email updates you’d like to receive on issues affecting your rule.
  10. Name your rule.
  11. Click Preview to ensure you’ve set up your rule to run the way you want. Previewing is just for verification and doesn’t make any permanent changes to your account.
  12. When you are done, click Save rule.

There are benefits to rules, in my mind for budget sake, not so extremely valuable. So that leaves us with paying for tools & or having a developer or engineer to build out some fancy scripts or internal platform that works with Google’s API. What if I do not have access to those resources and all I want to do is be an advertiser? I cannot, I have to learn coding and API stuff to include staying up-to-date on all of the U.I. changes and enhancements, which you can find in the PPC Hero Library.

See also  Google’s John Mueller Clears Confusion About Mobile-First Index

Why you are reading and how the script works.

This script manages your budget at the campaign level by the hour via a google sheet, so you can scale. To my knowledge and I have scoured the web, this is the first for the public. I did not write the original script. Which can be found here by Google. I simply deleted a bunch of stuff with lots of trial and error over a 1 year period of time and re-worked a few things to get it to manage budgets instead of bids.

The script allows you the flexibility of setting your budgets and forgetting about them within reason. If you want to get crazy, you can do what I do and use this script with the pacing script with few custom google sheets so that you have your own budget management tool and bidder. I figured if someone can build a tool to do this stuff and make millions of dollars, there has to be a free way to do it.

I am certain, almost positive there is a better way to write this script and more than certain there is a way to do it at the MCC level to manage multiple accounts. I have not figured that out. It would be great for those that see this that are devs, and or engineers, to make adjustments to this script and share a free version at the MCC level with your own enhancements.

How to set up the script

Before you run the script here are a few things that you need to change.

  1. Make a new Google Sheet. This is where the script will know which campaigns to Pause or UnPause, once you have created a new sheet copy the URL.
  2. Ensure your Tab name is set to “Rules” if not please make sure you update this line where “Rules is changed to whatever your Tab Name is: var spreadsheetAccess = new SpreadsheetAccess(SPREADSHEET_URL, “Rules“)
  3. Still working in Google Sheets, update Row 2 with your account number “000-000-0000” replace with your own.
  4. Row 3 is the time period reference for your script to run, if you want to execute after 7 days, 1 week or a month. Reference the below table for valid inputs for this row as it relates to your goal with controlling your budgets.
See also  Does Google use Google Analytics for Ranking Purposes?

Google ads script timeframe options

  • Starting in row 6, column C, you will want to add your budgets for that period
  • Lastly, in row 6, column D, you will want to list your campaigns.

I hope this helps you all in better controlling your budgets. Almost forgot, you can change the campaign.pause in the script to campaign.enable and adjust the simple formula if you want to duplicate the script and create another script to enable campaigns.


var SPREADSHEET_URL = "[]"; var spreadsheetAccess = new SpreadsheetAccess(SPREADSHEET_URL, "Rules"); var totalColumns; function main() { var columns = spreadsheetAccess.sheet.getRange(5, 2, 5, 100).getValues()[0]; for (var i = 0; i < columns.length; i ++) { if (columns[i].length == 0 || columns[i] == 'Results') { totalColumns = i; break; } } if (columns[totalColumns] != 'Results') { spreadsheetAccess.sheet.getRange(5, totalColumns + 2, 1, 1).setValue("Results"); } // clear the results column spreadsheetAccess.sheet.getRange(6, totalColumns + 2, 1000, 1).clear(); var row = spreadsheetAccess.nextRow(); while (row != null) { var budget; try { budget = parseBudget(row); } catch (ex) { logError(ex); row = spreadsheetAccess.nextRow(); continue; } var selector = AdWordsApp.campaigns(); for (var i = 2; i < totalColumns; i ++) { var header = columns[i]; var value = row[i]; if (!isNaN(parseFloat(value)) || value.length > 0) { if (header.indexOf("'") > 0) { value = value.replace(/\'/g,"\\'"); } else if (header.indexOf("\"") > 0) { value = value.replace(/"/g,"\\\""); } var condition = header.replace('?', value); selector.withCondition(condition); } } var campaigns = selector.get(); try { campaigns.hasNext(); } catch (ex) { logError(ex); row = spreadsheetAccess.nextRow(); continue; } var fetched = 0; var changed = 0; while (campaigns.hasNext()) { var campaign =; var oldCost = campaign.getStatsFor("THIS_MONTH").getCost(); var action = row[0]; var newStatus; fetched ++; if (budget <= oldCost) { campaign.pause(); changed++ } } logResult("Fetched " + fetched + "\nChanged " + changed); row = spreadsheetAccess.nextRow(); } var now = new Date(Utilities.formatDate(new Date(), AdWordsApp.currentAccount().getTimeZone(), "MMM dd,yyyy HH:mm:ss")); } function parseBudget(row) { if (row[1].length == 0) { return null; } var limit = parseFloat(row[1]); if (isNaN(limit)) { throw "Bad Argument: must be a number."; } return limit;
} function logError(error) { spreadsheetAccess.sheet.getRange(spreadsheetAccess.currentRow(), totalColumns + 2, 1, 1) .setValue(error) .setFontColor('#c00') .setFontSize(8) .setFontWeight('bold');
function logResult(result) { spreadsheetAccess.sheet.getRange(spreadsheetAccess.currentRow(), totalColumns + 2, 1, 1) .setValue(result) .setFontColor('#444') .setFontSize(8) .setFontWeight('normal');
} function SpreadsheetAccess(spreadsheetUrl, sheetName) { this.spreadsheet = SpreadsheetApp.openByUrl(spreadsheetUrl); this.sheet = this.spreadsheet.getSheetByName(sheetName); this.cells = this.sheet.getRange(6, 2, this.sheet.getMaxRows(), this.sheet.getMaxColumns()).getValues(); this.rowIndex = 0; this.nextRow = function() { for (; this.rowIndex < this.cells.length; this.rowIndex ++) { if (this.cells[this.rowIndex][0]) { return this.cells[this.rowIndex++]; } } return null; } this.currentRow = function() { return this.rowIndex + 5; }



How to Write For Google



How to Write For Google

Are you writing your SEO content based on the latest best practice tips?

I originally wrote this SEO copywriting checklist in 2012—my, how things have changed. Today, Google stresses quality content even more than before, conversational copy is critical, and there are revised SEO writing “rules.” 

I’ve updated the list to reflect these changes and to provide additional information.

As a side note, I would argue that there’s no such thing as “writing for Google.” Yes, there are certain things you should do to make the Google gods happy. However, your most important goal should be writing clear, compelling, standout copy that tells a story. 

I’m keeping the old headline in the hopes that I can convert some of the “write for Google” people to do things the right way.

Whether you’re an in-house SEO content writer, a DIY business owner, or a freelance SEO copywriter, this 27-point checklist will help you write engaging, Google-happy content—every time.

Items to review before you start your SEO writing project



– Do you have enough information about your target reader?

Your copy will pack a powerful one-two punch if your content is laser-focused on your target reader. Ask your client or supervisor for a customer/reader persona document outlining your target readers’ specific characteristics. If the client doesn’t have a customer persona document, be prepared to spend an hour or more asking detailed questions. 

Here’s more information on customer personas.


– Writing a sales page? Did you interview the client?

It’s essential to interview new clients and to learn more about their company, USP, and competition. Don’t forget to ask about industry buzzwords that should appear in the content.

Not sure what questions to ask to get the copywriting ball rolling? Here’s a list of 56 questions you can start with today. 



– Writing a blog post? Get topic ideas from smart sources

When you’re blogging, it’s tempting to write about whatever strikes your fancy. The challenge is, what interests you may not interest your readers. If you want to make sure you’re writing must-read content, sites like Quora, LinkedIn, Google Trends, and BuzzSumo can help spark some ideas.


– Did you use Google for competitive intelligence ideas?

Check out the sites positioning in the top-10 and look for common characteristics. How long are competing articles? Do the articles link out to authoritative sources? Are there videos or infographics? Do the articles include quotes from industry experts? Your job is to write an essay that’s better than what’s already appearing in the top-10 — so let the competition be your guide.


– Did you conduct keyphrase research?

Yes, keyphrase research (and content optimization) is still a crucial SEO step. If you don’t give Google some keyphrase “cues,” your page probably won’t position the way you want.


Use a keyphrase research tool and find possible keyphrases for your page or post. As a hint: if you are tightly focusing on a topic, long-tail keyphrases are your best bet. Here’s more information about why long-tail keyphrases are so important.

If you are researching B2B keyphrases, know that the “traditional” keyphrase research steps may not apply. Here’s more information about what to do if B2B keyphrase research doesn’t work.

See also  Google’s John Mueller Clears Confusion About Mobile-First Index


– What is your per-page keyphrase focus?

Writers are no longer forced to include the exact-match keyphrase over and over again. (Hurray!) Today, we can focus on a keyphrase theme that matches the search intent and weave in multiple related keyphrases.


– Did you expand your keyphrase research to include synonyms and close variants?

Don’t be afraid to include keyphrase synonyms and close variants on your page. Doing so opens up your positioning opportunities, makes your copy better, and is much easier to write!


Are you wondering if you should include your keyphrases as you write the copy — or edit them in later? It’s up to you! Here are the pros and cons of both processes.


 — Do your keyphrases match the search intent?

Remember that Google is “the decider” when it comes to search intent. If you’re writing a sales page — and your desired keyphrase pulls up informational blog posts in Google – your sales page probably won’t position. 


— Writing a blog post? Does your Title/headline work for SEO, social, and your readers?

Yes, you want your headline to be compelling, but you also want it to be keyphrase rich. Always include your main page keyphrase (or a close variant) in your Title and work in other keyphrases if they “fit.”

Here’s some excellent information on how to write headlines that get noticed (and that are good for Google.) You can also use headline-analyzing tools to double-check your work.



– Did you include keyphrase-rich subheadlines?

Subheadlines are an excellent way to visually break up your text, making it easy for readers to quick-scan your benefits and information. Additionally, just like with the H1 headline, adding a keyphrase to your subheadlines can (slightly) help reinforce keyphrase relevancy.

As a hint, sometimes, you can write a question-oriented subheadline and slip the keyphrase in more easily. Here’s more information about why answering questions is a powerful SEO content play.


Is your Title “clickable” and compelling?

Remember, the search engine results page is your first opportunity for conversion. Focusing too much on what you think Google “wants” may take away your Title’s conversion power. 

Consider how you can create an enticing Title that “gets the click” over the other search result listings. You have about 59 characters (with spaces) to work with, so writing tight is essential. 



– Does the meta description fit the intent of the page?

Yes, writers should create a meta description for every page. Why? Because they tell the reader what the landing page is about and help increase SERP conversions. Try experimenting with different calls-to-actions at the end, such as “learn more” or “apply now.” You never know what will entice your readers to click!


– Is your content written in a conversational style?

With voice search gaining prominence, copy that’s written in a conversational style is even more critical.

Read your copy out loud and hear how it sounds. Does it flow? Or does it sound too formal? If you’re writing for a regulated industry, such as finance, legal, or healthcare, you may not be able to push the conversational envelope too much. Otherwise, write like you talk.

See also  Google Search Allows Removal Of Personal Contact Information

Here’s how to explain why conversational content is so important.



–Is your copy laser-focused on your audience?

A big mistake some writers make is creating copy that appeals to “everyone” rather than their specific target reader. Writing sales and blog pages that are laser-focused on your audience will boost your conversions and keep readers checking out your copy longer. Here’s how one company does it.

Plus, you don’t receive special “Google points” for writing long content. Even short copy can position if it fully answers the searcher’s query. Your readers don’t want to wade through 1,500 words to find something that can be explained in 300 words.

Items to review after you’ve written the page


– Did you use too many keyphrases?

Remember, there is no such thing as keyword density. If your content sounds keyphrase-heavy and stilted, reduce the keyphrase usage and focus more on your readers’ experience. Your page doesn’t receive bonus points for exact-matching your keyphrase multiple times. If your page sounds keyphrase stuffed when you read it out loud, dial back your keyphrase usage.



– Did you edit your content?

Resist the urge to upload your content as soon as you write it. Put it away and come back to it after a few hours (or even the next day.) Discover why editing your Web writing is so very important. Also, don’t think that adding typos will help your page position. They won’t.


– Is the content interesting to read?

Yes, it’s OK if your copy has a little personality. Here’s more information about working with your page’s tone and feel and how to avoid the “yawn response.” Plus, know that even FAQ pages can help with conversions — and yes, even position.


– Are your sentences and paragraphs easy to read?

Vary your sentence structure so you have a combination of longer and shorter sentences. If you find your sentences creeping over 30 or so words, edit them down and make them punchier. Your writing will have more impact if you do.


Plus, long paragraphs without much white space are hard to read off a computer monitor – and even harder to read on a smartphone. Split up your long paragraphs into shorter ones. Please.


– Are you forcing your reader onto a “dead end” page?

“Dead-end” pages (pages that don’t link out to related pages) can stop your readers dead in their tracks and hurt your conversion goals. 

Want to avoid this? Read more about “dead-end” Web pages.


– Does the content provide the reader with valuable information?

Google warns against sites with “thin,” low-quality content that’s poorly written. In fact, according to Google, spelling errors are a bigger boo-boo than broken HTML. Make sure your final draft is typo-free, written well, and thoroughly answers the searcher’s query.


Want to know what Google considers quality content — directly from Google? Here are Google’s Quality Raters guidelines for more information.


– Did you use bullet points where appropriate?

See also  Google Explains How to Use the Search Console’s Index Coverage Report

If you find yourself writing a list-like sentence, use bullet points instead. Your readers will thank you, and the items will be much easier to read.

Plus, you can write your bullet points in a way that makes your benefit statements pop, front and center. Here’s how Nike does it.


– Is the primary CTA (call-to-action) clear–and is it easy to take action?

What action do you want your readers to take? Do you want them to contact you? Buy something? Sign up for your newsletter? Make sure you’re telling your reader what you want them to do, and make taking action easy. If you force people to answer multiple questions just to fill out a “contact us” form, you run the risk of people bailing out.


Here’s a list of seven CTA techniques that work.


– Do you have a secondary CTA (such as a newsletter signup or downloading a white paper?)

Do you want readers to sign up for your newsletter or learn about related products? Don’t bury your “sign up for our newsletter” button in the footer text. Instead, test different CTA locations (for instance, try including a newsletter signup link at the bottom of every blog post) and see where you get the most conversions.


– Does the page include too many choices?

It’s important to keep your reader focused on your primary and secondary CTAs. If your page lists too many choices (for example, a large, scrolling page of products), consider eliminating all “unnecessary” options that don’t support your primary call-to-action. Too many choices may force your readers into not taking any action at all.



– Did you include benefit statements?

People make purchase decisions based on what’s in it for them (yes, even your B2B buyers.) Highly specific benefit statements will help your page convert like crazy. Don’t forget to include a benefit statement in your Title (whenever possible) like “free shipping” or “sale.” Seeing this on the search results page will catch your readers’ eyes, tempting them to click the link and check out your site.


– Do you have vertical-specific testimonials?

It’s incredible how many great sales pages are testimonial-free. Testimonials are a must for any site, as they offer third-party proof that your product or service is superior. Plus, your testimonials can help you write better, more benefit-driven sales pages and fantastic comparison-review pages.

Here’s a way to make your testimonials more powerful. 

And finally — the most important question:



– Does your content stand out and genuinely deserve a top position?

SEO writing is more than shoving keyphrases into the content. If you want to be rewarded by Google (and your readers), your content must stand out — not be a carbon copy of the current top-10 results. Take a hard look at your content and compare it against what’s currently positioning. Have you fully answered the searcher’s query? Did you weave in other value-added resources, such as expert quotes, links to external and internal resources (such as FAQ pages), videos, and graphics? 

If so, congratulations! You’ve done your job. 

Source link

Continue Reading

Subscribe To our Newsletter
We promise not to spam you. Unsubscribe at any time.
Invalid email address