Hello!
I'm dealing with a big problem.
I've created a test MCC account to get an access to API, created several test clients account:
CLIENT / > Test Client Account 1 (264-130-2396)
CLIENT / > Test Client Account 2 (117-541-4601)
Now, when I'm trying to get a report (ACCOUNT_PERFORMANCE_REPORT), after checking whether account is not MCC, I'm still getting this error:
"Details: [fieldPath: selector.reportDefinition; trigger: ; errorString: ReportDefinitionError.CUSTOMER_SERVING_TYPE_REPORT_MISMATCH]"
Here's my code:
if (! $managedCustomer->getCanManageClients()) {
// --> Checked 100 times: this code works only when ManagedCustomer object's getCanManageClients() getter returns FALSE
$reportSession = (new AdWordsSessionBuilder())
->withOAuth2Credential($oauth2)
->withDeveloperToken(env('ADWORDS_DEVELOPER_TOKEN'))
->withClientCustomerId($_managedCustomer->customer_id)
->build();
// --> No matter which clientCustomerId is mentioned, i've tried all of them hardcoded - none of them works (2641302396, 1175414601)
... ... ...
$reportTemporaryFilePath = sprintf(
'%s.csv',
tempnam(sys_get_temp_dir(), 'report-')
);
$selector = new Selector();
$selector->setFields([
'Cost',
'Conversions',
'CostPerAllConversion',
'Impressions',
'AverageCpm',
'Ctr',
'Clicks',
'AverageCpc',
'ConversionRate',
'InvalidClicks',
'InvalidClickRate',
]);
$reportDefinition = new ReportDefinition();
$reportDefinition->setSelector($selector);
$reportDefinition->setReportType(
ReportDefinitionReportType::ACCOUNT_PERFORMANCE_REPORT);
$reportDefinition->setReportName(
'AAPR_' . uniqid()); // Adwords Account Performance Report
$reportDefinition->setDateRangeType(
ReportDefinitionDateRangeType::TODAY);
$reportDefinition->setDownloadFormat(DownloadFormat::CSV);
$reportDownloader = new ReportDownloader($session);
... ... ...
$reportDownloadResult = $reportDownloader->downloadReport($reportDefinition); // --> Here I'm getting this error
}
What's the problem?
How can I solve it?