Advanced Budgets - User Guide

The script prevents you from going over your target budget

What does the Advanced Budgets script do?

This enhanced script checks if a keyword, ad, ad group or campaign is exceeding budget and pauses it automatically. It pauses the entity if the budget exceeds and then enables it again after the budget period has ended. The script enables you to:

  • Set budgets for campaigns, ad groups, keywords, or ad texts.
  • Set budgets for monthly, weekly or daily periods.
  • Pause items when their cost exceeds the maximum budget you specified.
  • Re-enable paused items when a new budget period starts.
  • Get notifications via email when changes are made or when an account exceeds a total cost for the period.
  • Compatible with the following campaign and ad group types: search, display, shopping


This script can pause the following types of items:

  • Campaigns
    • Search campaigns
    • Display campaigns
    • Video campaigns
    • Shopping campaigns
  • Ad Groups
    • Search ad groups
    • Display ad groups
    • Video ad groups
    • Shopping ad groups
  • Keywords
    • Search keywords
  • Ads
    • Expanded Text ad
    • Text ad (legacy format)
    • Gmail Image ad
    • Gmail Single Promotion ad
    • Gmail Multi Product ad
    • HTML5 ad
    • Image ad
    • Mobile ad
    • Mobile image ad
    • Product ad
    • Responsive Display ad
    • Rich Media ad
    • Template ad
    • Video Ads

The script can also alert (but not make automatic changes) for the following items:

  •  Keywords
    • Video keywords
    • Display keywords 

How does it work?

Choose the account you want to run the script in and go to the All Enhanced Scripts page. The script lets you set basic and advanced settings. You can have multiple settings for different budget periods and items. For example, one setting can be to pause keywords; another can be to pause account if the monthly budget exceeds.

Basic Settings

  1. Maximum Budget Amount:
    Enter the budget amount you want to pause the item for. The number in this field applies to each individual item. For example, if you set the budget amount to $10 and set the 'items to check' to keywords, the system will pause or report all keywords that exceed that amount individually.
  2. Items To Check:
    Select the items or entities in your AdWords account that you want to check the budget for. You can select - Account, Campaign, Ad Group, Ad Text or Keyword.
  3. Budget Period:
    This field mentions the time period the budget is valid for - daily, weekly, monthly. For the weekly option, you can choose the day the week starts on (Monday or Sunday).
  4. Pause Items:
    You can choose to pause entities or only generate a report. By default, this setting is set to 'No'.
  5. Email Addresses To Notify:
    The emails addresses that should be sent an email after the script runs.

Advanced Settings

There are a few advanced setting options that let you choose which keywords, ads, ad groups and campaigns you would like to monitor. Advanced settings give you more control but are optional.

  • Check Only Items With This Label:
    Mention the AdWords label you want the script to check. The script will only check keywords, ads, ad groups or campaigns that have that label. For example, if you want to make sure non-brand keywords don't spend over a certain amount, you can label non-brand keywords and enter the label text in this field.

    This is CaSe SeNsItIvE. The label must exist at the level of the entity whose costs you are checking. For example, if you are checking campaign level costs, the campaigns must have this label. When checking the account's cost, any label settings are ignored but you can achieve the same use case by switching to campaign budgets with a label.
  • Campaign Name Contains:
    • Check only campaigns whose name includes this text. Case insensitive.
    • This setting can be combined with "Check Only Items With This Label". When combined, both settings need to match (if one setting works, but the other one doesn't, the setting will fail)
    • You can only use one name (you can't separate different names with a comma).
  • Ad Group Name Contains:
    Check only ad groups whose name includes this text. Case sensitive. This setting can be combined with "Check Only Items With This Label".

    If item to check is either Account or Campaign, this setting will be override
  • Aggregate Costs:
    This allows you to consider the total cost of all items that matched the search criteria. When selected, the aggregate cost is compared to the budget. When not checked, each matched item's cost is individually compared to the budget.
  • Text Of Label To Add:
    In this field, you can mention the additional label you want to add to items that are paused by the script. The default is 'stopped_by_budget_script'.
  • Reenable Items:
    If you would like the script to re-enable items that were paused by the script, you can change this field to 'yes'. To leave them paused, select 'no'.

Advanced settings for managing budgets in bulk via a Google Sheet

When you manage many accounts with frequently changing budgets, it may be more efficient to use a Google Spreadsheet to maintain settings. Make a copy of our sample spreadsheet into your own Google account and then enter the URL and tab name in the following Advanced Settings:

Note: When you use a spreadsheet, settings found there override whatever values you have entered for the fields "Maximum Budget Amount," "Items To Check," "Budget Period," "Check Only Items With This Label," "Campaign Name Contains," "Ad Group Name Contains," and "Aggregate Costs."

Sample spreadsheet:

When using the spreadsheet, you need to enable access to it, otherwise the script won't be able to access to it to retrieve the budgets' data

How to install and run the enhanced script

After entering the details for the setting, click on 'Save Settings'. This will give you an option to 'Download' the script which can then be installed in the AdWords account. For detailed steps on how to install a script in AdWords read this article. This script can also be run at the MCC level. This article explains how to install and run enhanced scripts at the MCC level.

Recommendations and Tips

  1. Google AdWords has a 30-minute limit on scripts. If the account is very large and the script is checking keywords or ads, it'll time out before running through the whole account. A workaround to this is to create multiple settings and use a different label in each setting.
  2. When you run the script the first time, run it with the 'Pause Items' field set to 'No' to see the results. If everything looks good, edit the setting in Optmyzr to automatically pause and resume items when the budget period ends.
  3. Schedule the script to run every hour in the AdWords account to make sure the paused items can be enabled when the budget period ends. It will also make sure the items can be paused as soon as they hit the budget.

Read more about tools for budget management in our blog post here

Usage Tips and Examples

It can be tricky to set the Enhanced Script up correctly so here are a few tips and examples.

The script will evaluate entities in the account that match the combination of 'Items to Check' and filters like the following:

  • 'Check Only Items With This Label'
  • 'Campaign Name Includes'
  • 'Ad Group Name Includes'

You can combine filters for labels and names. For example, if you select 'Campaign', with label 'Search' and name includes 'BMM', the script will look ONLY at campaigns that have both the label 'Search' and whose name includes 'bmm' in any capitalization.

When you set 'Items to Check' to 'Account,' no filters for labels or names will be used.

Items to Check
Label or Name filters
Pause when the cost of my entire account is too high
Pause when any campaign's cost exceeds the maximum cost
Pause any campaign with the label 'Test Label' when that campaign exceeds the maximum cost
Test Label
Pause all campaigns with the label 'Test Label' when the aggregate cost for all campaigns with this label exceeds the maximum cost. This also pauses campaigns whose individual cost is below the maximum cost.
Test Label

Can’t find what you’re looking for?

Our award-winning customer care team is here for you.