Hi,

Im using AWQL to get ACCOUNT_PERFORMANCE_REPORT and it is super slow. Im 
just retrieving 16 accounts and it will be fetched after 30seconds. is 
there any other way to speed it up? even if my application is deployed in a 
cloud server. here's my code below.



 
$adWordsServices = new AdWordsServices();
$managedCustomerService = $adWordsServices->get(
$session,
ManagedCustomerService::class
);

$selector = new Selector();
$selector->setFields(['CustomerId', 'Name']);
$selector->setOrdering([new OrderBy('Name', SortOrder::ASCENDING)]);
$selector->setPaging(new Paging(0, 500));
$selector->setPredicates([new Predicate('CustomerId',PredicateOperator
::NOT_EQUALS,[$managerId])]);

$clients = $managedCustomerService->get($selector);
foreach($clients->getEntries() as $num => $client)
{
// if($client->getCanManageClients() != null)
// if($num == 5)
// break;

$selector = new Selector(); 
$selector->setFields( ['AccountDescriptiveName','Clicks','Impressions','Ctr'
,'Conversions','ConversionRate','Cost','AveragePosition','AverageCpc','Date'] 
);

$reportDefinition = new ReportDefinition();
$reportDefinition->setSelector($selector);
$reportDefinition->setReportName(
'ACCOUNT_PERFORMANCE_REPORT'
);
$reportDefinition->setDateRangeType(
ReportDefinitionDateRangeType::ALL_TIME
);
$reportDefinition->setReportType(
ReportDefinitionReportType::ACCOUNT_PERFORMANCE_REPORT
);
$reportDefinition->setDownloadFormat(DownloadFormat::CSV);
$clientSession = (new AdWordsSessionBuilder())
->withDeveloperToken("96J8o73Dd6aETSWSMhjSZA")
->withOAuth2Credential($auth)
->withClientCustomerId($client->getCustomerId())
->build();

$reportDownloader = new ReportDownloader($clientSession);
$reportSettingsOverride = (new ReportSettingsBuilder())->
includeZeroImpressions(false)->build();
$reportDownloadResult = $reportDownloader->downloadReport(
$reportDefinition,
$reportSettingsOverride
);

//dd(explode(',',$reportDownloadResult->getAsString()));
$array = explode(PHP_EOL,$reportDownloadResult->getAsString());
foreach($array as $n => $row)
{
if($n == (count($array) - 1))
unset($array[$n]);
}
foreach($array as $n => $row)
{
if($n == (count($array) - 1)){
$account = explode(',',$row);
$accounts[] = [
'account' => $client->getName(),
'Clicks' => $account[1],
'Impressions' => $account[2],
'Ctr' => $account[3],
'Conversions' => $account[4],
'ConversionRate' => $account[5],
'Cost' => $account[6],
'AveragePosition' => $account[7],
'AverageCpc' => $account[8] 
];
}
}

//dd($accounts);
}

$accounts = collect($accounts);

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/6ee63bcf-8c68-4065-931b-94edf43d71f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • ... Albert Paolo Rogelio
    • ... Albert Paolo Rogelio
      • ... 'Bharani Cherukuri (AdWords API Team)' via AdWords API and Google Ads API Forum

Reply via email to