Pause underperforming ads with this updated AdWords script

It’s no secret that split (A/B) testing is an essential part of a successful AdWords campaign.

I’m a big advocate of scientific testing, and it is a core part of how my company, Brainlabs, approaches paid search campaigns.

Some time ago, I shared our A/B testing script, which enables you to set up control and experiment campaigns that are alternately paused and resumed, and then emails you when the test has significant results for click-through rate (CTR) or conversion rate (CR).

However, there’s no point in running tests if you don’t know how to interpret the results. That’s why we made our Rotating Ad Copy script, which helps you choose which ads from your test have the best performance.

We’ve now updated the script to make it even better!

What’s new?

There are three main updates to the Rotating Ad Copy script:

  • It works better with the expanded text format — better late than never!
  • You can automatically label ads as winners or losers, allowing you to easily check which ones are underperforming.
  • The script can now also pause the losing ads, so you can be assured that you’re not wasting any more impressions.

What does it do?

While running an ad copy test, this script identifies the best ad in the experiment and shows you how much better your account would be doing if you paused the losing ads.

It goes through each ad group to find the best ad, and then works out how many extra impressions that ad would have gotten if the other ads had been paused by using an estimate of average impressions and total impressions of the ad group.

This is especially useful if you’ve got a big account and have lost track of all the tests going at the moment.

How does this script know which ad is the best for you? You can set the key performance metric yourself. If CTR or CR matters to you, you’ll be able to adapt the script to your needs. It will choose the winning ad based on your chosen metric.

Once it has identified the best- and worst-performing ads, the script can either label the losing ads so you can review them yourself or automatically pause them.

How to use it?

To get started, make a blank Google spreadsheet for the report to be pulled into and note its URL. On your AdWords interface, go to Bulk Actions, then choose Scripts to go to the Scripts page. Click on the big “+” button to create a new one, and paste in the script. Change the settings below as needed:

  • spreadsheetUrl is the URL of a Google Doc spreadsheet, which the results will be written into. Create a blank spreadsheet and put the URL in here.
  • Set labelAds to true if you want winning and losing ads to be labeled, so you can find them easily in your account.
  • labelTextForWinningAds is the text used to label the winning ads.
  • labelTextForLosingAds is the text used to label the losing ads.
  • Set pauseLosingAds to true if you want the script to automatically pause the losing ads.
  • campaignNameContains and campaignNameDoesNotContain filter which campaigns the script gets data from. For example, if campaignNameContains is [“Brand,” “Generic”], then only campaigns with names containing “brand” or “generic” are included. If campaignNameDoesNotContain is [“Display,” “Competitor”], then any campaigns with names containing “display” or “competitor” are ignored.
  • This is not case-sensitive.
  • Leave blank, [], to include all campaigns.
  • If you need to put a double quote into campaignNameContains or campaignNameDoesNotContain, put a backslash before it.
  • ignorePausedCampaigns should be set to true if you only want to look at currently active campaigns, or false if you want to include paused ones.
  • Similarly, ignorePausedAdGroups should be set to true if you only want to look at currently active ad groups or false if you want to include paused ones.
  • conversionMetrics lists which conversion metrics will appear in the spreadsheet. You can have “Conversions,” “ConversionValue” or both.
  • You have to pick which metric is used to determine the winning ad. Put that metric’s name in winningMetricName — This is used to name columns in the spreadsheet.
  • The winning metric is calculated by dividing one metric (winningMetricMultiplier) by another (winningMetricDivisor). For example, if the winning metric is CTR, the winningMetricMultiplier is “Clicks,” and the winningMetricDivisor is “Impressions.”
  • The script assumes the largest winning metric is the best. You want the highest CTR or the highest conversion per impression.
  • impressionThreshold and clickThreshold are the minimum number of impressions and clicks on ads that need to be considered.
  • The script will look at the performance of the ads over a time period specified by dateRange.
  • You can use predefined date ranges like “LAST_30_DAYS,” “LAST_MONTH” or “THIS_MONTH.”
  • Or you can make your own with the format “yyyymmdd, yyyymmdd” — the first date is the start and the second is the end. For example “20180101, 20180430” would cover January 1 to April 30, 2018.
  • currencySymbol will be stuck in front of any currency values (i.e., costs and conversion values) in the spreadsheet.

If you’re having trouble with the script timing out, try running it multiple times using campaignNameContains and campaignNameDoesNotContain to look at different campaigns for each run. But the script will clear the Google Sheet when it runs, so make sure to use a different URL each time or save the data somewhere else.

Some notes:

  • Only enabled ads that aren’t disapproved are considered.
  • Ad groups where all ads are tied to the same winning metric are ignored. For example, if all winning metric values are 0, the ad group will be ignored.
  • The totals shown will not be the same as your account’s totals. This only reports the performance of ad groups with winning and non-winning ads.
  • If the winningMetricMultiplier or winningMetricDivisor are not already one of the reported metrics, they will also be reported on. For example, if conversionMetrics was”Conversions,” but the winningMetricMultiplier was “ConversionValue,” then both conversions and conversion value would be reported in the spreadsheet.


Opinions expressed in this article are those of the guest author and not necessarily Search Engine Land. Staff authors are listed here.


About The Author