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