Hi I using AWQL to retrieve Account performance of all accounts in a mcc
account but it is really slow. im just getting 16 accounts and it will
consume up to 35seconds it is really bad. is there any way to speed it up?
i mean it is deployed in cloud server so it means it should be fast. im
confused it is it just the google api which is slow or my way in retrieving
data? here is my code:
$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(MY_DEVELOPER_TOKEN)
->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/a7c5aa64-8010-4692-93a6-eb782febb23e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.