Google recommend three or more ads per Ad group to ensure enough copy is being tested.

Checking each Ad group would take forever. This script will count how many ads are in each Ad group, total ads (including paused) and a few stats.

It will count both Text Ads and Expanded Text Ads (ETAs).

Setup

  1. Copy & paste your Google Spreadsheet link, replacing “your-sheet-link”
  2. Enter your tab name in the same manner, this can be anything you like
  3. Done. We recommend setting this to run daily

/**
* AutomatingAdWords.com - Ad Counter
*
* This script will count how many ads you have live
* Google recommend 3 or more. This will count both standard ads and ETAs
* Go to automatingadwords.com for installation instructions & advice
*
* Version: 1
**/
var spreadsheetURL = "your-sheet-link";
var sheetName = "your-tab-name";
 
 var spreadsheet = SpreadsheetApp.openByUrl(spreadsheetURL);  
 
function main() {
 checkAds();
}
 
 
function checkAds(){

  
 var currentSheet = spreadsheet.getSheetByName(sheetName);
 var adminRow = 2;
 currentSheet.clear();
 
  var header = [["Campaign", "AdGroup", "Live Ads", "Total Ads", "Imps", "CTR", "Conv. Rate"]];
  currentSheet.getRange("A1:G1").setValues(header);
  
 var adGroups = AdWordsApp
 .adGroups()
 .forDateRange("LAST_30_DAYS")
 .withCondition("CampaignStatus = ACTIVE")
 .withCondition("AdGroupStatus = ENABLED")
 .withCondition("Status = ENABLED")
 .withCondition("CampaignName DOES_NOT_CONTAIN 'PL'")
 .withCondition("CampaignName DOES_NOT_CONTAIN 'Dynamic Remarketing'")
 .get();
 
 var row = 2;
 while (adGroups.hasNext()) {
 var adGroup = adGroups.next(); 
 currentSheet.getRange(row, 1).setValue(adGroup.getCampaign().getName());
 currentSheet.getRange(row, 2).setValue(adGroup.getName());
  
 var numOfAds = 0; 
 var numOfTotalAds = 0;
 var ads = adGroup.ads().withCondition("Type in [EXPANDED_TEXT_AD, TEXT_AD]").get();

 while(ads.hasNext())
 {
 var ad = ads.next();
 var adStats = ad.getStatsFor("LAST_30_DAYS")
 var impressions = adStats.getImpressions();
 var CTR = adStats.getCtr();
 var convRate = adStats.getConversionRate();
 if(ad.isEnabled()){
 numOfAds++;
 numOfTotalAds++;
 }else{
 numOfTotalAds++;
 }
 currentSheet.getRange(row, 3).setValue(numOfAds);
 currentSheet.getRange(row, 4).setValue(numOfTotalAds);
 currentSheet.getRange(row, 5).setValue(impressions);
 currentSheet.getRange(row, 6).setValue(CTR);
 currentSheet.getRange(row, 7).setValue(convRate);

 } 
 row++; 
 }
  

 adminRow++;
 }


 


Leave a Reply

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