AdWords
5.3K members online now
5.3K members online now
Use AdWords conversion tracking and reporting to measure your results. Have a question about Google Analytics? Post it here, on the Google Analytics Community!
Guide Me
star_border
Reply

executeInParallel question

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

 

I've created a geo performance report for all of my accounts and am trying to make it faster by using the executeInParallel method. However, my use of executeInParallel has only made the script run slower. Any suggestions on how to improve the script? Additionally, is there any way to incorporate SQL language such as "case when" into AWQL? The current script spits out a large number of cells and I'd like to lessen that. Thanks!

 

var SPREADSHEET_URL = URL; //url hidden for security purposes
 var spreadsheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL);
 var sheet = spreadsheet.getSheetByName("Geo_Performance_Report")
 var ACCOUNTS = []
 
function main() 
{
  //get accounts and data respectively
  var accountSelector = MccApp.accounts();
  if (ACCOUNTS.length > 0) {
    accountSelector = accountSelector.withIds(ACCOUNTS);
  }

  var accountIterator = accountSelector.get();

  while (accountIterator.hasNext()) {
    var account = accountIterator.next();
    Dashboard(account);
    Logger.log('Done processing %s', account.getCustomerId());
  }
  executeInParallel("Dashboard");
}



function Dashboard(account) {
    MccApp.select(account);
    var report = AdWordsApp.report(' SELECT AccountDescriptiveName, Date, CountryCriteriaId , CampaignName, RegionCriteriaId, MetroCriteriaId, CityCriteriaId, Impressions, Clicks, Cost' +
                                   ' FROM GEO_PERFORMANCE_REPORT' +
                                   ' WHERE Cost > 0' +
                                   ' DURING YESTERDAY');
    var rows = report.rows();
  while (rows.hasNext()){
    var row = rows.next();
    sheet.appendRow([row['AccountDescriptiveName'], row['Date'], row['CountryCriteriaId'], row['CampaignName'], row['RegionCriteriaId'], row['MetroCriteriaId'], row['CityCriteriaId'], row['Impressions'], row['Clicks'], row['Cost']]);
  }
}
  

 

1 Expert replyverified_user
Marked as Best Answer.
Solution
Accepted by topic author Edward D
September 2016

executeInParallel question

Top Contributor
# 2
Top Contributor

Edward,

 

There's a dedicated AdWords script related forum, where you might be interested in posting this technical query:- https://groups.google.com/forum/#!forum/adwords-scripts

 

Pankaj