Find ads without RSA or ETA - in a large MCC account without timing out

26 views
Skip to first unread message

lea.h...@commissionsinc.com

unread,
Jan 11, 2022, 1:35:17 PMJan 11
to Google Ads Scripts Forum
Hi,
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.

Thanks in advance for your help!

/**********************
Below script is adapted from- https://optimizationup.com/adwords-scripts-check-expanded-text-ads/
ETA Checker
Created by Ahmed Ali, https://optimizationup.com
MCC 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()] );
}
 }
    }

Google Ads Scripts Forum Advisor

unread,
Jan 12, 2022, 2:41:16 AMJan 12
to adwords...@googlegroups.com
Hello,

Thank you for reaching out to us.

With regard to your concern, I'm afraid that the Google Ads Scripts is not designed to iterates to a huge amount of accounts in which the limitation document state it as well that you can only process up to 50 accounts. With that in mind, we would recommend to create multiple copy of the script, then lessen the number of each iterations.  Also, you might consider using Google Ads API instead which is more suitable to your use case.

Regards,
Google Logo
Teejay Wennie Pimentel
Google Ads Scripts Team
 
 

ref:_00D1U1174p._5004Q2Uix0O:ref
Reply all
Reply to author
Forward
0 new messages