I'm trying to run an MCC script that pulls ad group details to a sheet if an ad group is enabled, campaign is enabled, and the ad group is missing an RSA or ETA ad. Our MCC has over 2,000 accounts, and the below script, which I made some edits to after finding it on Optimization Up by Ahmed Ali, is timing out after going through only 31 accounts. Ahmed Ali's script used var accountIterator = MccApp.accounts().executeInParallel('ETA'); but I received an error message “Selector was too large. Cannot call executeInParallel on a selector with more than 50 elements." so I took out the executeinParallel part. I'd like for a script to be able to get through all 2000 accounts, or if I have to break up the MCC into batches using a label, would prefer to have the script run through at least 500 active accounts before timing out. Is there something in the below version of the script that is inefficent? The last edit I made to try to speed it up was adding .withCondition("Clicks = 0").forDateRange("THIS_MONTH") to the ad group selector, since these ad groups we're wanting to identify won't have any clicks, as they're missing ad copy.
Below script is adapted from-
https://optimizationup.com/adwords-scripts-check-expanded-text-ads/ETA Checker
Created by Ahmed Ali,
https://optimizationup.comMCC Version 1.0
**********************/
var SPREADSHEET_URL = 'PASTE_YOUR_GOOGLE_SHEET_URL_HERE';
var sheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL).getActiveSheet();
function main() {
sheet.clearContents();
sheet.getRange("A1").setValue("Account ID");
sheet.getRange("B1").setValue("Account Name");
sheet.getRange("C1").setValue("Campaign");
sheet.getRange("D1").setValue("Ad groups");
sheet.getRange("E1").setValue("ETA Count");
sheet.getRange("F1").setValue("RSA Count");
sheet.getRange("G1").setValue("Campaign ID");
sheet.getRange("H1").setValue("Ad Group ID");
var accountIterator =
AdsManagerApp.accounts().withCondition("Clicks > 0")
.orderBy("Clicks DESC")
.forDateRange("THIS_MONTH").get();
while (accountIterator.hasNext()) {
var account = accountIterator.next();
AdsManagerApp.select(account);
Logger.log(account.getName() + ", " + account.getCustomerId());
ETA();
}
}
function ETA() {
var GetAdGroups = AdWordsApp.adGroups()
.withCondition('Status = ENABLED')
.withCondition("Clicks = 0").forDateRange("THIS_MONTH")
.withCondition("AdvertisingChannelType = SEARCH")
.withCondition("AdGroupName DOES_NOT_CONTAIN_IGNORE_CASE 'dynamic'")
.withCondition('CampaignStatus = ENABLED')
.get();
for (var row = 2; GetAdGroups.hasNext(); row ++) {
var AdGroups = GetAdGroups.next();
var RSAadCount = AdGroups.ads().withCondition('Type=RESPONSIVE_SEARCH_AD').withCondition('Status = ENABLED').get().totalNumEntities();
var ETACount = AdGroups.ads().withCondition('Type=EXPANDED_TEXT_AD').withCondition('Status = ENABLED').get().totalNumEntities();
if ((RSAadCount + ETACount < 1)) {
sheet.appendRow( [AdWordsApp.currentAccount().getCustomerId(),AdWordsApp.currentAccount().getName(), AdGroups.getCampaign().getName(), AdGroups.getName(), ETACount ,RSAadCount, AdGroups.getCampaign().getId(), AdGroups.getId()] );
}
}
}