I'm using google-api-php-client to get the AdmobMediation report remotely from our servers
Every thing works fine, except that the response report is only related to the "Admob Network", not the "Mediation report"
so as a result, the metrics are Incomplete
So I have two questions:
Is there a way to get Mediation report instead of only Admob Network report using the SDK?
Is there a way to download a saved report we made on "Admob dashboard" using the php SDK?
$startDate = '2019-04-01';
$endDate = '2019-04-09';
$AppId = 'xxxx';
$accountId = 'xxxx';
/*
Create the client
*/
$client = new Google_Client();
$client->addScope('https://www.googleapis.com/auth/adsense.readonly');
$client->setAccessType('offline');
/*
Authentication
*/
$client->setClientId('xxx');
$client->setClientSecret('xxx');
$client->setRedirectUri("urn:ietf:wg:oauth:2.0:oob");
$refreshedAccessToken = $client->refreshToken('xxx');
$client->setAccessToken($refreshedAccessToken);
/*
Create the service
*/
$service = new Google_Service_AdSense($client);
/*
Get the result
*/
$metrics = array(
'AD_REQUESTS', 'VIEWED_IMPRESSIONS', 'IMPRESSIONS_RPM', 'CLICKS', 'REACHED_AD_REQUESTS',
'IMPRESSIONS_CTR', 'COST_PER_CLICK', 'AD_REQUESTS_RPM', 'EARNINGS'
);
$filter = array(
'APP_ID==' . $AppId
);
$optParams = array(
'currency' => 'USD',
'metric' => $metrics,
'dimension' => 'DATE',
'sort' => '+DATE',
'filter' => $filter,
'useTimezoneReporting'=>true
);
$result = $service->accounts_reports->generate($accountId, $startDate, $endDate, $optParams);