Snippets

Frederick Vallaeys xy4jR: Untitled snippet

Created by Frederick Vallaeys
function main() {
  var adGroupIterator = AdWordsApp.adGroups().withCondition('Status = ENABLED').withCondition('CampaignStatus = ENABLED').get();
  while (adGroupIterator.hasNext()) {
    var adGroup = adGroupIterator.next();
    // Keyword Checks
    var keywordIterator = adGroup.keywords().withCondition('Status = ENABLED').get();
    var numKeywords = keywordIterator.totalNumEntities();
    if(numKeywords >= 15) {
      var campaignName = adGroup.getCampaign().getName();
      var adGroupName = adGroup.getName();
      Logger.log(campaignName + "    " + adGroupName + "      # keywords: " + numKeywords);
    }
    // Ad Checks
    var adIterator = adGroup.ads().withCondition('Status = ENABLED').get();
    var numAds = adIterator.totalNumEntities();
    if(numAds < 2) {
      var campaignName = adGroup.getCampaign().getName();
      var adGroupName = adGroup.getName();
      Logger.log(campaignName + "    " + adGroupName + "      # ads: " + numAds);
    }
  }
}

Comments (0)