Another Free Adwords Split Testing Script


Split Testing For More Wins

Continuing from my first free Adwords split testing script, I thought I would share another script I run weekly to help me find adgroups that need new ads created for split testing.

My first script very simply:

  • Hunted down adgroups with 2 active ads.
  • Checked if enough data had been collected.
  • Paused the lower performing CTR ad automatically.

But what happens if you never had 2 active ads to begin with? What happens once the 1st script paused the lower performing ad for you?

We need to always ensure every adgroup has 2 active ads running and this script identifies which adgroups fall into this problem.

By running this script daily, you will be able to see to find which adgroups only have 1 active ad based on the information it spits out to the log.


// Comma-separated list of recipients.

//This scipt list all the Ad Groups with only one Ad Text.
//A/B testing for Ads is essential to improve CTR
function main() {
var consoleText = "";
var numOfAdGroups = 0;
var justOneAdText = 0;

//Get All Enabled Campaigns
//It's just because to help list the AdGroups groupped by Campaign
//The list will be ordered by Impressions to see the most important Ad Groups first
var campaignIterator = AdWordsApp.campaigns()
.orderBy("Impressions DESC")
.withCondition("Status = ENABLED")

while (campaignIterator.hasNext()){
var campaign =;

//Get All Enabled AdGroups within the Campaign
var adGroupIterator = AdWordsApp.adGroups()
.withCondition("CampaignName CONTAINS_IGNORE_CASE '" +
campaign.getName() + "'")
.withCondition("Status = ENABLED")

while (adGroupIterator.hasNext()){

var adgroup =;
var adTextNum = 0;
//Get All Enabled Ad Text within the Ad Group
var adIterator =
.withCondition("AdGroupName CONTAINS_IGNORE_CASE '" +
adgroup.getName() + "'")
.withCondition("CampaignName CONTAINS_IGNORE_CASE '" +
campaign.getName() + "'")
.withCondition("Status = ENABLED")
.withCondition("Type = TEXT_AD")

while (adIterator.hasNext()) {
var ad =;
//Increase the adTextNum if a Text Ad found.


if (adTextNum < 2) {

adgroup.getCampaign().getName() +
", " +
adgroup.getName() +
", - has one or less active Ad Text."


Logger.log('Ad Text report finished.');


Share This Post On Facebook Or Twitter Below. Thanks!

Hi! I'm Jason Brown and I’m a 36 year old digital marketing intrapreneur living in beautiful Louisville, Kentucky. I've been involved with the Internet since 1996 and have personally made millions online with my creative marketing tactics and persistence. I blog about marketing, money, and motivation. Thanks for stopping by!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>