Hello,
I'm trying to get a report with all active extension withing active account.
Before I can even get to the AdWordsApp.report() method I get an error:
Ca: Could not read from Google Ads
at main (Code:25:25)
at Object.<anonymous> (adsapp_compiled:20507:54)
function main() {
var activeIds = [];
var allAccountSelector = AdsManagerApp.accounts();
var accountIterator = allAccountSelector.get();
while (accountIterator.hasNext()) {
var accounts = accountIterator.next();
var hasImpressions = accounts.getStatsFor("LAST_30_DAYS");
if (hasImpressions.getImpressions() > 0) {
var accountId = accounts.getCustomerId();
activeIds.push([accountId]);
}
}
Logger.log(activeIds)
var customerIds = activeIds.map(ids => '"' + ids.join("-") + '"');
var accountSelector = AdsManagerApp.accounts().withIds(customerIds).get();
while(accountSelector.hasNext()){
var account = accountSelector.next();
MccApp.select(account);
}}
i don't get an error when I define
accountSelector with the customerIds variable...
the error is prompted when I start the while loop... why?