Category Archives: Mcc Scripts

Advanced Budgets - Pause When Things Spend Too Much


Get more control over how much you spend on AdWords with this Enhanced Script.

Maintain your own advanced budgets:

  • 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.

How It Works

  • The script can check all items at the selected level of the account:
    • the entire account
    • all enabled campaigns
    • all enabled ad groups
    • all enabled keywords
    • all enabled ad texts
  • The script can also be configured to check only those items from the above list that have an AdWords label that you've created.
  • The script checks if the cost for any item exceeds the maximum allowed during the current budget period.
  • When the cost of an item exceeds the maximum amount, the item is labeled and paused.
  • When the script runs during the first hour of the start of a new budget period, it re-enables any paused items with the label that was added when the script paused the item.
  • The script sends an email when items are paused or re-enabled.
  • If the script is used to check the cost for an entire account, it will only send a notification email when the cost exceeds the allowed amount. It does NOT pause the account. It will continue to send the warning email until there are no active campaigns in the account or until the next budget period starts.
  • The script has been tested to work with the following campaign and ad group types: search, display, shopping.

Example Use Cases

Send yourself an email when the cost of an entire account is coming close to your total budget for the month so that you can pause the campaigns to prevent incurring more charges than you want for the month.

Limit the amount of money you spend on experimental keywords by adding a label to experimental keywords and then checking that none of these keywords exceed your maximum allowed cost for the day, the week, or the month.

Read Before Using

IMPORTANT - This script must be scheduled to run every hour if you want it to re-enable paused items at the start of a new budget period. If the script does NOT run during the first hour of the start of a new budget period, your items will remain paused.

This script is limited by Google's current limits for how many items can be checked. This means that the script will only be able to check up to 250,000 entities. If you need to check more, you can use labels and set up multiple settings using Optmyzr's patent-pending Enhanced Script technology.

Hourly Campaign-Level Dayparting for AdWords


This script lets you set hourly bid adjustments for every campaign in AdWords. The AdWords website limits users to 6 dayparts per day. This script enables 24 hourly dayparts by updating the bid adjustments for the next 5 hours. By running this script automatically every hour, you will always have your desired bid adjustments ready for the next couple of hours.


Your bid adjustments can be set by making a copy of this Google Spreadsheet.

  • Make a new tab for every campaign you want this script to manage. The name of the tab should be an exact match of the name of the campaign in AdWords. This is case sensitive.
  • To temporarily pause bid adjustments for a campaign, you can add the word 'paused' before or after the name of the tab.
  • If you want to apply the same dayparting bid adjustments to all active and paused campaigns, use the tab with the name "All Campaigns"

Different Bid Adjustments Per Campaign

AdWords accepts bids ranging from -90% to +900%. If your value falls outside this range, the spreadsheet will highlight the incorrect field in red. The script will break if you use values outside of Google's accepted range.


To set a bid that is 90% lower than your normal bid from 1am to 2am on Mondays, enter the value '-90%' in the row labeled "MONDAY" and the column labeled "1".

To set a bid that is 50% higher on Sundays from 3pm to 4pm, enter the value '50%' in the row labeled "SUNDAY" and the column labeled "15". (the script uses 24-hour notation)

Just like in Google's dayparting settings, you are entering the bid adjustments so if you want your bid to be 150% of normal, you enter 50% as the bid adjustment. This 50% gets added to the regular bid, and we get your desired bid that is 150% of normal.

Hourly Bid Adjustments in AdWords


If this script fails to run for more than 5 hours in a row, your account will have incorrect bid adjustments. When you no longer want to use this script, be sure to manually remove all dayparting bid adjustments.

Bid adjustments are stacked on top of each other. If you have geo bid adjustments and device bid adjustments, make sure you take these into consideration. For example, if your device modifier is 120%, and your geo modifier is 75% and your daypart adjustment is 110%, your final bid is 120% * 75% * 110% = 99%.

Install this Enhanced Script in your Optmyzr account.

Enhanced Script: Performance By Keyword and Query Type


The purpose of this script is to provide insight into the key performance metrics for

  • different keyword match types (exact, phrase, exact)
  • keywords of differing word lengths (1-word, 2-words, ..., 10-words)
  • query match types (broad, broad (session-based), exact, exact (close variant), phrase, phrase (close variant))
  • query lengths (1-word, 2-words, ..., 10-words)

The script produces a Google spreadsheet with aggregated metrics for each of the keyword and query types.

This script can be enabled from the Enhanced Scripts™ section of your Optmyzr account.

Enhanced Script: Pause keywords with a low Quality Score


This AdWords Script generates a Google Sheet with a list of all the active keywords in your account that have a Quality Score lower than a predefined Quality Score. It also provides the option to pause these keywords.

This script provides other metrics like cost, impressions etc. for a given period of time to help you gauge the performance of keywords in your account prominently.


Example Use Cases

  • Get a list of keywords that fall below a certain quality score and optimize them
  • Do a regular clean up of your AdWords account by pausing keywords with very low Quality Scores

Settings and Customization

  • EMAILADDRESS:  tells the script the email addresses that should get a notification when it finishes creating the spreadsheet. To send to multiple recipients, separate the email addresses with a comma. Do NOT include the name of the person... only include their email address.
  • QualityScore: defines the threshold Quality Score for the keywords to be identified.
  • Pause: To pause keywords with a lower quality score, change the value of the field Pause to true.
  • Date_Range:  tells the script the date range to include in the calculation. E.g. 'LAST_30_DAYS'. You can also use the format 'YYYYMMDD,YYYYMMDD'.

Get This Script

You can run this script from the Enhanced Scripts™ section in your Optmyzr account.


Enhanced Script: Ad Template Report


This AdWords Script produces a report of the various elements of your ad texts. It aggregates data for commonly used headlines, URLs and description lines, and also for entire ads that you use in multiple places in the account.


Example Use Cases

  • Find the best performing ad text elements in your AdWords account
  • Find the best headline, description or display URL for new ad texts
  • Get enough data to make statistically valid decisions about ad text performance by aggregating data from similar ads across an entire account.

Settings and Customizations

Please refer to the script download page for the settings.

Get This Script

You can run this script from the Enhanced Scripts™ section in your Optmyzr account.


Turn a spreadsheet into AdWords ads

Enhanced Script: Create Ads From a Spreadsheet


This AdWords Script automatically creates ad groups, ad texts, keywords and labels based on your template and a spreadsheet of your data. It can be used to turn a product database into an AdWords account or it can be used as an alternative to the AdWords interface or the AdWords Editor for creating new ads. Because the code can be easily modified, it is also more flexible than most solutions that involve the AdWords API.

Turn a spreadsheet into AdWords ads
Turn any Google Spreadsheet into AdWords ads using the template you define in our AdWords Script.

Example Use Cases

This AdWords automation is useful for a wide range of use cases:

  • Advertisers who already have a spreadsheet of all their services and products can use this to build out an account with great structure that will benefit your quality score.
  • Agencies who work with a lot of clients in the same vertical and who have a well defined best practice for building out new accounts can use this to speed up new account creation.
  • Advertisers whose inventory changes frequently can use this to tie their ad creation directly to their backend.
  • Agencies who create Google Merchant Feeds can use this to add a value-add service where they use the feed to create AdWords ads for their clients.

Settings and Customizations

  • SOURCEDATA tells the script the location of the Google Spreadsheet that contains your data.
  • NAMEOFDATASHEET tells the script the name of the sheet in the spreadsheet that contains the data. A spreadsheet can contain multiple sheets and this lets the script know which one to use.
  • EMAILADDRESS tells the script the email addresses that should get a notification when it finishes creating ads. To send to multiple recipients, separate the email addresses with a comma. Do NOT include the name of the person... only include their email address.
  • ACCOUNTNAME is used by the script to create the subject line of the email it sends. When you're using this script on multiple accounts, it makes it easier to know which account each email notification is about.

Under The Hood

The script will automatically add a new column called "Added to Accounts" to your Google Spreadsheet. When it creates an ad using this row of the spreadsheet, it adds the account ID in this column. The next time the script runs, it will skip this row. This is useful to prevent adding duplicate ad texts and to make the script faster, for example by only making ads for rows you added to the sheet since you last ran it.

 How To Use The Script To Generate Ads Automatically


Get This Script

You can run this script from the Enhanced Scripts™ section in your Optmyzr account.

Enhanced Script: Collect Hourly Stats for AdWords


Collect Hourly AdWords StatsHave you ever wanted a way to get more granular stats for AdWords than what's available from the AdWords website? Well then this AdWords automation script is for you... It saves stats for campaigns, ad groups and keywords you choose to a spreadsheet once per hour. It can even save the maximum CPC and the Quality Score, two elements whose historical values are not saved inside AdWords.

Example Use Cases

  • Keep track of attributes that the AdWords system does not provide historical data for. For example, use this script to record the Quality Score of your most important keywords every hour. AdWords does not store historical QS so the only way to get this data is to save it.
  • Understand the delivery curve for your ads so you can understand if most of your budget is spent at a particular time of the day. The next time your boss wants to know why the account spend seems low for the day, you can use this hourly data to make sure things are running as expected and show that spend always picks up later in the day.
  • Monitor your top 10 most important keywords more closely than the rest of your account by automatically putting their latest stats into a spreadsheet which you can then use to feed into a dashboard.
Automatically get stats for your most important campaigns, ad groups and keywords from AdWords every hour.
Automatically get stats for your most important campaigns, ad groups and keywords from AdWords every hour.

Under The Hood

This script runs once per hour and stores the daily stats for the selected items at that time. Because stats can be delayed and because the script may run at any time during the hour, you will see an hour-by-hour progression in the recorded stats but you will not see stats for specific hours. Usually scripts will run at the same time every hour so you might see stats for today through 8:23am on one line and then stats for today through 9:23am on the next line.

Because this script stores a lot of data in Google Spreadsheets, you should frequently create a new spreadsheet to make sure it doesn't reach its limits. For example, create a new spreadsheet weekly or biweekly depending on the amount of data you're collecting. This script can be adapted to automatically start a new spreadsheet on a predefined cycle but that requires storing the current spreadsheet URL somewhere (for example in a label or in another spreadsheet).

Get This Script

You can run this script from the Enhanced Scripts™ section in your Optmyzr account.


Enhanced Script: Date Range Comparison


This script makes it easier to compare the performance of an account across two date ranges. It downloads reports including account data, campaign data, ad group data, keyword data and ad text data for the two time periods you specify and then combines them into a single Google Spreadsheet that shows the percent change for each item.

Compare AdWords performance for 2 date ranges
Compare AdWords performance for 2 date ranges

Example Use Cases

  • Get a report every Monday that shows last week's account performance compared to two weeks ago
  • Get a report on the first of the month that shows last month's account performance compared to two months ago
  • Get a report that compares the same number of days (and same days of the week) before and after an optimization was made

Settings and Customizations

Replace the following variables with your own values: campaignNameSelectorStatement, time, daysInReport, spreadsheetUrl, includeAccountLevel, includeCampaignLevel, includeAdGroupLevel, includeKeywordLevel, includeAdLevel

campaignNameSelectorStatement (optional)

The campaignSelectorStatement tells the script on which campaigns to operate. It uses the syntax from AdWords Scripts for .withCondition(condition)

  • For example, to operate on all campaigns in an account use: CampaignName CONTAINS_IGNORE_CASE ”
  • To work only on the campaign named "Campaign #1", use: CampaignName = 'Campaign #1'

It is optional when you want to include only account level data. Otherwise this is a required value.

time, daysInReport, optimizationDate, preStartDate, preEndDate, postStartDate, postEndDate (required)

These variable tells the script what type of dates to compare. The allowed values are:

  • Around Opt
  • Specific
  • Last Months
  • Previous Days

"Around Opt" tells the script to look before and after the date of an optimization. A value for daysInReport and optimizationDate is required when you use this.

"Specific" tells the scripts that you will tell it the exact start and end dates for the two periods to compare. A value for preStartDate, preEndDate, postStartDate, postEndDate is required when you use this

"Last Months" tells the script to compare last month's data to two months ago.

"Previous Days" tells the script to compare the last x days with the x days before that. The value of x can be specified in daysInReport which is required when you use this.


This variable tells the script the URL of the Google Spreadsheet where it should store the results. Allowed values are either the full URL to a Google Spreadsheet or "NEW". In the case of "NEW", the script will create a new spreadsheet to store the results.


This tells the script if it should include an account level comparison. Set to 1 for yes or 0 for no


This tells the script if it should include a campaign level comparison. Set to 1 for yes or 0 for no


This tells the script if it should include an ad group level comparison. Set to 1 for yes or 0 for no


This tells the script if it should include a keyword comparison. Set to 1 for yes or 0 for no


This tells the script if it should include an ad text level comparison. Set to 1 for yes or 0 for no


Under The Hood

This script compares the values for any account items during two periods of time and reports the percent change. It can be modified to send alerts when there is a big change or it can be modified to try and correlate changes so that it can pinpoint the items that need your attention the most.

Get This Script

You can run this script from the Enhanced Scripts™ section in your Optmyzr account.

Landing Page Watch Dog


Automatically check your AdWords account for landing pages that are broken, either because they don't load, contain 404 server errors or contain text that indicates a problem of another sort. This script generates a spreadsheet with a list of all the potentially broken landing page URLs used by ads or keywords in your account and allows you to optionally delete or pause any of these items.

Get a spreadsheet that shows all your landing pages that have potential  problems.
Get a spreadsheet that shows all your landing pages that have potential

Example Use Cases

  • Retailers can pause ads when a product goes out of stock
  • Pause ads for products that have a low review score based on user comments
  • Delete ads that lead to broken landing pages

Settings and Customizations


This setting tells the script if you want to check only keyword destination URLs, only ad destination URLs or all destination URLs. Valid options are:

  • all
  • kw
  • ad


This setting lets you tell the script to only evaluate a portion of your account. It uses the AdWords Script syntax for the .withCondition clause. If you don't know what that means, don't worry, these examples should make it clear:

  • To select everything in the account, you can use the line "CampaignName CONTAINS ''" and that's what the script is already set to use if you don't change it.
  • To select all the destination URLs for campaigns that include the word 'search', you could use the line "CampaignName CONTAINS_IGNORE_CASE 'search'"


This tells the script what text to search for on your landing page. For example, you could tell it to look for the phrase "out of stock". If you want to search for multiple phrases, put a comma between them but do NOT add a space after the comma, for example "out of stock,low inventory" tells the script to look for the phrase "out of stock" or "low inventory". When at least 1 of these phrases is matched, the script wil report this and delete or pause the item as per your request. The search is case insensitive so use lower case for this setting.


Set this setting to 1 so that the script will just report about problems. If set to 1, the script will NOT try to delete or pause anything in the account. We recommend you set this to 1 the first few times to make sure the script is finding only the items you want before you start to delete or pause these items automatically.


This setting tells the script to disable any item it finds that has a destination URL that is broken or that contains one of the phrases you are looking for on the page. When set to 1, it disables what it finds.


This setting does the opposite of the setting 'disable'. It enables any items that have a destination URL where the phrases you are searching for are found. This can be useful to automatically re-enable ads when a product comes back into stock. Set this to 1 to enable items. Note that you should never set both 'disable' and 'enable' to 1.


This setting tells the script the URL of the Google Spreadsheet where it should store its findings. You can either enter the URL or put in the text "NEW" to have the script automatically create a new spreadsheet every time it runs.


This setting is where you tell the script what you call the account. It's just used for notifications and for naming the spreadsheet so that you can more easily find what you're looking for. So go ahead and name it something that makes sense to you but avoid special characters like slashes, dollar signs and anything else you wouldn't normally use for file names.

Under The Hood

This script goes through every item that has a destination URL in the specified portion of your account and checks if the page loads correctly without a 404 error. If the page does not load correctly, it pauses the item or just notifies you depending on your settings. It also loads the content of the landing page and checks whether it contains the specified phrases of text. If the text is found, it enables or disables the item or notifies you based on your settings.

This script will only pause or unpause items, it cannot delete anything.

The script is able to follow redirects in your destination URLs but if you want to test whether your redirects are compatible, take a look at our FAQs for instructions.

Download Script


Mcc Version of Landing Page Watch Dog:

The MCC (My client center accounts) version of this AdWords script checks broken landing pages runs for all or specific child accounts. It has the same functionality as mentioned above.

Additional Settings and Customization:

In addition to the above settings, you can customise it to choose the child accounts you want to run it for under your MCC account.


This setting tells the script the number of accounts you want to run this script for. When set to default i.e. blank, the script checks the broken landing pages for all the child accounts under the AdWords MCC account. To run for specific child accounts, you can add the AdWords account id of those child accounts separated by a comma.

Download Mcc Script

Tip: AdWords places a limit of 30 minutes on MCC scripts as well. If you have too many child accounts in the MCC then create multiple versions of this script in the MCC account and pick a different set of child accounts for each.