AdWords
1.8K members online now
1.8K members online now
Get started with AdWords - learn the basics to get set up for success
Guide Me
star_border
Reply

How to find ad groups with only 1 ad?

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I've been tasked with ad testing in a very large, messy account.

 

I'm trying to find ad groups with only 1 ad so that I can write up new ads to test against the solitary ads in these groups. 

 

Is there any way to filter ad groups based on the number of ads they contain?

 

Thanks,

Ben

1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Ben Z
September 2015

Re: How to find ad groups with only 1 ad?

[ Edited ]
Participant ✭ ✭ ☆
# 2
Participant ✭ ✭ ☆

Hi Ben!

 

You can use AdWords scripts. Below is an example code.

It searches for all enabled ad groups in all enabled campaigns with less then 2 text ads and apply label "Less than 2 ads" to those groups.

 

function main() {

  AdWordsApp.createLabel("Less then 2 ads", "","#FF0000");
  var campaigns = AdWordsApp.campaigns().withCondition("Status = ENABLED").get();
  while(campaigns.hasNext()){
    var campaign = campaigns.next();
    var adGroups = campaign.adGroups().withCondition("Status = ENABLED").get();
    while(adGroups.hasNext()){
      var adGroup = adGroups.next();
      var ads = adGroup.ads().withCondition("Type = TEXT_AD").withCondition("Status = ENABLED").get();
      if(ads.totalNumEntities() < 2){

        adGroup.applyLabel("Less then 2 ads");
        Logger.log(campaign.getName() + " > " + adGroup.getName());
      }
    }
  }
}

View solution in original post

Marked as Best Answer.
Solution
Accepted by topic author Ben Z
September 2015

Re: How to find ad groups with only 1 ad?

[ Edited ]
Participant ✭ ✭ ☆
# 2
Participant ✭ ✭ ☆

Hi Ben!

 

You can use AdWords scripts. Below is an example code.

It searches for all enabled ad groups in all enabled campaigns with less then 2 text ads and apply label "Less than 2 ads" to those groups.

 

function main() {

  AdWordsApp.createLabel("Less then 2 ads", "","#FF0000");
  var campaigns = AdWordsApp.campaigns().withCondition("Status = ENABLED").get();
  while(campaigns.hasNext()){
    var campaign = campaigns.next();
    var adGroups = campaign.adGroups().withCondition("Status = ENABLED").get();
    while(adGroups.hasNext()){
      var adGroup = adGroups.next();
      var ads = adGroup.ads().withCondition("Type = TEXT_AD").withCondition("Status = ENABLED").get();
      if(ads.totalNumEntities() < 2){

        adGroup.applyLabel("Less then 2 ads");
        Logger.log(campaign.getName() + " > " + adGroup.getName());
      }
    }
  }
}