Saturday, October 29, 2022

Digest for adsense-api@googlegroups.com - 2 updates in 1 topic

braimah jake <braimahjake@gmail.com>: Oct 27 06:28AM -0700

Hi,
 
I am working with the Google APIs Client Library for PHP
 
I can successfully authenticate and refresh tokens, but cannot generate
reports.
 
Here's a sample of my code:
 
$params = array(
'date_range' => ['YESTERDAY'],
'metrics' => [
'PAGE_VIEWS', 'AD_REQUESTS', 'AD_REQUESTS_COVERAGE',
'CLICKS', 'AD_REQUESTS_CTR', 'COST_PER_CLICK',
'AD_REQUESTS_RPM', 'ESTIMATED_EARNINGS'
],
 
);
 
$optParams = array('metric' => array('PAGE_VIEWS', 'CLICKS',
'ESTIMATED_EARNINGS'), 'dimension' => 'AD_UNIT_ID', 'AD_UNIT_NAME');
 
$report =
$httpClient->get("https://adsense.googleapis.com/v2/accounts/MY-ACCOUNT/?"
. http_build_query($optParams) . "/reports:generate");
 
return json_decode($report->getBody());
Ad Sense API <adsenseapi@forumsupport.google>: Oct 28 03:25PM

Thanks for your question.
 
I suggest trying the interactive API explorer at https://developers.google.com/adsense/management/reference/rest/v2/accounts.reports/generate to check your request.
 
If that fails, perhaps you could share the errors you are getting, which should help diagnose the problem.
 
Regards,
Andrew, AdSense API team
ref:_00D1U1174p._5004Q2fpGLd:ref
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to adsense-api+unsubscribe@googlegroups.com.

No comments:

Post a Comment