All posts by Frederick Vallaeys

Limit AdWords Budget

Pause Campaigns, Ad Groups, or Keywords When They Spend Too Much

Purpose

This AdWords Script can automatically pause campaigns, ad groups, and keywords when they reach a predefined spend threshold and re-enable them the following day.Limit AdWords Budget

Example Use Cases

  • Limit the maximum cost for a new keyword or ad group you are testing
  • Set different daily spend limits for campaigns so that it can spend a different amount on weekdays vs weekends

Settings and Customizations

You have to create two copies of this script and place them both in your AdWords account. The first runs hourly and checks if spend today for any campaign, ad group, or keyword with the label 'Limit Daily Spend' is greater than 100, and if so, pause it.

The second copy of this script should be set to run every morning between midnight and 1am and enables any campaigns, ad groups, or keywords with the label 'Limit Daily Spend'. This is needed so your items that got paused by the hourly script are automatically unpaused every day.

The settings below let you customize whether the script works on campaigns, ad groups, keywords, or ads; the label name you are using to identify items that should be evaluated; the maximum cost; the time range to evaluate; and the email to notify:

  • scope - accepted values are "Campaigns", "Ad Groups", "Keywords", "Ad Text"
  • maxCost - set this to the maximum cost for each item.
  • dateRange - the amount of time in which the item is allowed to accrue no more than the maxCost - TODAY, LAST_7_DAYS, LAST_14_DAYS, LAST_30_DAYS
  • labelName - set this to the name of the label you are applying to the items to be included
  • email - set this to the email address to get a notification when the script makes changes

Download Script

Calculate and Set Mobile Bid Modifiers

Purpose

The purpose of this AdWords Script is to bring AdWords performance on mobile devices in line with performance on desktop + tablet. With the introduction of Enhanced Campaigns in Google AdWords, it is no longer possible to have a separate campaign for mobile; now mobile is part of a regular campaign and bids are controlled with a mobile bid multiplier that can be set from -100% to 300%. This script sets the mobile bid adjustment to bring mobile performance in line with the results of desktop+tablet.

Download Script

Example Use Cases

  • Calculate and set the campaign level mobile bid modifier for all your AdWords campaigns
  • Calculate the ad group level mobile bid modifiers and email a spreadsheet with recommended changes that can be applied through AdWords Editor

Acknowledgments

This script was written by Russell Savage of FreeAdWordsScripts.com. As such, this script is part of the free section of our AdWords Scripts Library.

This script uses the methodology explained by Kohki Yamaguchi on MarketingLand.com to automate setting the appropriate mobile bid modifier.

 

Settings and Customizations

Set the date range to use for calculating multipliers. You can also use the format YYYYMMDD,YYYYMMDD

  • 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'.
  • LEVEL: Set to Campaign if you want to calculate at the Campaign level and have the changes made by the script or set to AdGroup if you want to calculate at the AdGroup level and make the changes manually in AdWords Editor. Making changes at the Ad Group level is not supported by AdWords Scripts as of the time of publication. When that becomes available, we'll update this script.
  • TO: set to the email addresses that should receive the file with recommended changes if running the script at the AdGroup level. E.g. ['example@example.com','example2@example.com'].
  • METRIC: Set to ROAS to use Return On Ad Spend for the calulcation or set to RPC to use Revenue Per Click for the calculation. To understand the difference refer to the explanation on MarketingLand.com.
  • MINIMUM_BID_ADJUSTMENT: The lowest allowed bid adjustment to set or suggest, e.g. 0.5 for a -50% bid modifier.
  • MAXIMUM_BID_ADJUSTMENT:  The highest allowed bid adjustment to set or suggest, e.g. 3 for a +300% bid modifier.
  • DECIMAL_PLACES: Use this to adjust the number of decimal places to keep for calculations, e.g. 3.

Under The Hood

This script looks for the difference in ROAS or RPC performance between mobile and desktop+tablet. It analyzes keyword level data and applies either a cost or click-based weighting to the suggested multiplier.

  • Keywords that have no conversions are excluded from any calculations.
  • For keywords that have mobile conversions but NO desktop+tablet conversions, a 300% bid increase is used while doing the weighted calculation.
  • If there are no mobile conversions, but there are desktop+tablet conversions, a 100% bid reduction is used in the weighted formula.
  • For keywords that have both mobile and desktop+tablet conversions, the ratio of these is used in the weighted calculation.

Download Script

Turn a spreadsheet into AdWords ads

Enhanced Script: Create Ads From a Spreadsheet

Purpose

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

Purpose

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

Purpose

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.

spreadsheetUrl

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.

includeAccountLevel

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

includeCampaignLevel

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

includeAdGroupLevel

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

includeKeywordLevel

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

includeAdLevel

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.

Remove Underperforming Ads

Purpose

This script helps you keep only the best performing ad variations in your account by removing underperforming ads. Google can automatically show your best performing ads more frequently but it's always a good idea to prune your account and remove ads that are not performing well. Ideally you should always have at least 2 ads running so that you can test which variation is better.

Example Use Cases

  • Reduce all ad groups in an account down to the 2 best active ad texts before doing new ad variation testing
  • Clean up underperforming ads in an account you just started to manage
  • Run a monthly cleanup of all ad variation experiments you started at the beginning of the month

Settings and Customizations

Replace the following variables with your own values: campaignSelectorStatement, deleteAds, pauseAds, email, minAdsToKeepPerAdGroup, suggestMode, time

campaignSelectorStatement (required)

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'

deleteAds and pauseAds (required)

These variables tell the script if you want to delete or pause the lowest performing ads. Set one to a value of 1 and the other to a value of 0

minAdsToKeepPerAdGroup  (required)

This variable tells the script the minimum number of ads to keep in each ad group. If you set this value to 2, then the script will only pause or delete ads if there are at least 3 ads in the ad group. We recommend starting with a value of 2

suggestMode  (required)

This variable tells the script if it should make changes in the account or not. If set to 1, ads will be paused or deleted based on your specifications. If set to 0, then the script's output log will include an overview of its recommendations but no changes will be made. We recommend first running the script in suggestMode and only turning this off after you've read through the recommendations and are satisfied that it is making sensible suggestions.

time  (required)

This variable tells the script the time range of data to use to make its decisions. This should be long enough to have at least 100 impressions per ad group and 25 impressions per ad text but not so long that the time range spans a period of time when a lot of ad text changes were made in the account. We recommend using a value of last 14 days or last 30 days.

Allowed values are one of the following as specified in the AdWords Scripts documentation for selecting time ranges:

  • TODAY
  • YESTERDAY
  • LAST_7_DAYS
  • THIS_WEEK_SUN_TODAY
  • LAST_WEEK
  • LAST_14_DAYS
  • LAST_30_DAYS
  • LAST_BUSINESS_WEEK
  • LAST_WEEK_SUN_SAT
  • THIS_MONTH
  • LAST_MONTH
  • ALL_TIME

 

Under The Hood

This script looks through all the active text ads in an account or a set of campaigns and suggests the ones that should be removed based on what share of impressions Google's algorithm is giving each ad. Ads that get a disproportionally low percentage of impressions are Google's way of saying the ads are not optimal so we remove these by pausing or deleting them. Because we don't want to remove an ad that Google doesn't like if it's a big contributor to your clicks or conversions, the script won't suggest any of these for removal.

Warnings

The script cannot see when ads were paused or activated so it can't do a perfect apples-to-apples comparison. It assumes that all ads in an ad group were active for the same amount of time. This means that if you run the script using a 14-day lookback window and there is an ad in the ad group that you created yesterday, that ad will have a very low 'percent served' value purely because it was only able to compete with the other ads for 1 out of 14 days. In this case, the script would incorrectly believe this was a bad ad and remove it. To avoid this situation, only run the script on ad groups that have not had any ad changes during the period of time used for the analysis.

Download Script

Landing Page Watch Dog

Purpose

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

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

scope

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

campaignNameSelectorStatement

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'"

textToMonitor

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.

suggestMode

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.

disable

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.

enable

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.

spreadsheetUrl

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.

accountName

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.

accountsToCheck:

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.

Enhanced Script: Account Quality Score Calculator

Purpose

This script provides insight into elements of the AdWords Quality Score that are not available elsewhere in AdWords. It calculates an account weighted average quality score as well as weighted averages for each campaign and ad group. This can help you select which elements of an account to target for optimization. The account level quality score can also be used to measure the impact of the work you do in an account. You can email the daily quality score calculation to yourself to have a historical record of how your performance has changed.

AdWords Account Quality Score in a Dashboard Widget
AdWords Account Quality Score in a Dashboard Widget

Example Use Cases

  • Find the top spending campaigns whose quality scores are lower than the account average and target these for a relevance optimization
  • Store the account level quality score in a spreadsheet for historical charting
  • Email a notification to someone when the quality score of an account passes a threshold set by you
  • If you'd rather not deal with a script, check out our hosted Quality Score Tracker tool

Under The Hood

This script is based on the methodology for calculating weighted quality scores explained by Brad Geddes.

Get This Script

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