SEARCH_QUERY_PERFORMANCE_REPORT runs really slow while iterating through MCC accounts

25 views
Skip to first unread message

Hezi

unread,
Sep 29, 2014, 2:17:29 PM9/29/14
to adwords...@googlegroups.com
I've build a script that iterates through all of my MCC accounts and output simple report of "SEARCH_QUERY_PERFORMANCE_REPORT", but the iteration of the reports through all the accounts is REALLY SLOW(approximately 30 account per 2 min) and it goes over the 30 min regulation and stops - is there any solution for that ?

 i attached my code - please tell me if i'm missing something here ...

function main() {
  getAccounts()
}

//Get Mcc Accounts ID'S
function getAccounts()
{
  //Add account id to be excluded from the iteration 
  var accountExcludeIds = new Array();

  var accountSelector = MccApp
  .accounts()
  .forDateRange("LAST_7_DAYS")
  .orderBy("Cost DESC");
  
  var accountIterator = accountSelector.get();
  while (accountIterator.hasNext()) 
  {
    var account = accountIterator.next();
    
    MccApp.select(account);
    if(accountExcludeIds.indexOf(account.getCustomerId()) == -1)
    {
    var report = AdWordsApp.report(
      'SELECT Query, KeywordId, AdGroupId, KeywordTextMatchingQuery ' +
      'FROM   SEARCH_QUERY_PERFORMANCE_REPORT ' +
      'DURING LAST_7_DAYS');
    var rows = report.rows();
    while (rows.hasNext()) 
    {
      var row = rows.next();
      var query = row['Query'].toLowerCase();
      var KeywordId = row['KeywordId'];
      var AdGroupId = row['AdGroupId'];
      var KeywordTextMatchingQuery = row['KeywordTextMatchingQuery'].toLowerCase();
      
      Logger.log(query + ' ' + KeywordId + ' ' + AdGroupId + ' ' + KeywordTextMatchingQuery);
         
     }
   }
  }
}


Thanks !

Anash Oommen

unread,
Oct 10, 2014, 1:21:45 PM10/10/14
to adwords...@googlegroups.com
Hi Hezi,

You can use the executeInParallel option, it should make the throughput better. SQR might take a while depending on the account on which it is running, and this is independent of the Scripts environment.

Cheers,
Anash P. Oommen,
AdWords Scripts Team.
Reply all
Reply to author
Forward
0 new messages