You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems accessing "header" and "row" data from AdMob's GenerateNetworkReportRequest doesn't work as expected. Maybe I'm missing something obvious, but I can't find anything about access the report values of this object like we can with the AdSese report response. The returned object "Google\Service\AdMob\GenerateNetworkReportResponse" doesn't return any values for calls to getHeader() or getRow(), nor do the magic functions of the base model "\Google\Model" work because there are no types set for "headerDataType" or "rowDataType".
The equivalent "Google\Service\Adsense\ReportResult" works well for AdSense, but the AdMob Report Result doesn't seem to have any built-in way to access the underlying data except to convert the reponse using "toSimpleObject()";
Am I missing something or does should "headerDataType" and "rowDataType" of GenerateNetworkReportRequest be set to "array"?
Environment details
OS: Ubuntu 18.04.5 LTS
PHP version: 7.4.18
Package name and version: v2.10.1
Steps to reproduce
Generate a GenerateNetworkReportRequest
Set the setReportSpec()
Call the AdMob service accounts_networkReport->generate($name, $reportRequest);
This returns "Google\Service\AdMob\GenerateNetworkReportResponse" as expected and "modelData[]" is complete with the request report data. But there are no methods available to access the data without converting to a simple object.
Code example
// Load the GoogleClient - This works$GoogleClient = new \Google\Client();
$GoogleClient->addScope(\Google\Service\AdMob::ADMOB_READONLY );
$GoogleClient->setAccessType('offline');
$GoogleClient->setAuthConfigFile( ... ); // Omitted - Authentication works fine // Create an AdMob Service - This works - We can query for the Account data and run reports $AdMobService= new \Google\Service\AdMob($this->GoogleClient);
// Setup date range - Skipped details for brevity $dateRange = new \Google\Service\AdMob\DateRange();
$dateRange->setStartDate( ... )
$dateRange->setEndDate( ... )
// Setup report spec - Date and Earnings over range
$reportSpec = new \Google\Service\AdMob\NetworkReportSpec();
$reportSpec->setDimensions([ 'DATE' ]);
$reportSpec->setMetrics([ 'ESTIMATED_EARNINGS' ]);
$reportSpec->setDateRange($dateRange);
// Generate network report - Returns an AdMob\GenerateNetworkReportRequest $networkReportRequest = new \Google\Service\AdMob\GenerateNetworkReportRequest();
$networkReportRequest ->setReportSpec($reportSpec);
$ReportResponse = $AdMobService->accounts_networkReport->generate("AccountName", $networkReportRequest );
// Try and output any values of the report - Like we can with the AdSense report resultvar_dump($ReportResponse ->header); // NULLvar_dump($ReportResponse ->getHeader()); // NULLvar_dump($ReportResponse ->row); // NULLvar_dump($ReportResponse ->rows); // NULLvar_dump($ReportResponse ->getRow()); // NULL// This works - OBJ is populated with the contents of the report $OBJ = $ReportResponse->toSimpleObject();
The $ReportResponse will contain all of the data of the report, I've pasted part of the response below.
Maybe I'm doing something wrong, but it seems I should be able to access the report data directly from the response object.
It seems accessing "header" and "row" data from AdMob's GenerateNetworkReportRequest doesn't work as expected. Maybe I'm missing something obvious, but I can't find anything about access the report values of this object like we can with the AdSese report response. The returned object "Google\Service\AdMob\GenerateNetworkReportResponse" doesn't return any values for calls to getHeader() or getRow(), nor do the magic functions of the base model "\Google\Model" work because there are no types set for "headerDataType" or "rowDataType".
The equivalent "Google\Service\Adsense\ReportResult" works well for AdSense, but the AdMob Report Result doesn't seem to have any built-in way to access the underlying data except to convert the reponse using "toSimpleObject()";
Am I missing something or does should "headerDataType" and "rowDataType" of GenerateNetworkReportRequest be set to "array"?
Environment details
Steps to reproduce
Code example
The $ReportResponse will contain all of the data of the report, I've pasted part of the response below.
Maybe I'm doing something wrong, but it seems I should be able to access the report data directly from the response object.
Google\Service\AdMob\GenerateNetworkReportResponse^ {#2515
#footerType: "Google\Service\AdMob\ReportFooter"
#footerDataType: ""
#headerType: "Google\Service\AdMob\ReportHeader"
#headerDataType: ""
#rowType: "Google\Service\AdMob\ReportRow"
#rowDataType: ""
#internal_gapi_mappings: []
#modelData: array:5 [
0 => array:1 [
"header" => array:2 [
"dateRange" => array:2 [
"startDate" => array:3 [
"year" => 2021
"month" => 8
"day" => 4
]
"endDate" => array:3 [
"year" => 2021
"month" => 8
"day" => 11
]
]
"localizationSettings" => array:1 [
"currencyCode" => "USD"
]
]
]
1 => array:1 [
"row" => array:2 [
"dimensionValues" => array:1 [
"DATE" => array:1 [
"value" => "20210804"
]
]
"metricValues" => array:1 [
"ESTIMATED_EARNINGS" => array:1 [
"microsValue" => "3570"
]
]
.....
The text was updated successfully, but these errors were encountered: