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.

Thursday, October 13, 2022

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

Ad Sense API <adsenseapi@forumsupport.google>: Oct 12 11:57AM

Hi Stefan, I apologize for the delayed response.
 
Are you able to use the API tester on the developer site to experiment with the API calls first? And if so, does that result in a successful response?
 
Try this URL, first change the account field to what the account you'd like to query, then hit "Execute" at the bottom of the right hand side panel (the "Try this method" panel):
https://developers.google.com/adsense/management/reference/rest/v2/accounts.reports/generate?apix_params=%7B%22account%22%3A%22accounts%2Fpub-123%22%2C%22dateRange%22%3A%22LAST_7_DAYS%22%2C%22dimensions%22%3A%5B%22URL_CHANNEL_NAME%22%5D%2C%22metrics%22%3A%5B%22ESTIMATED_EARNINGS%22%5D%7D
 
If that's showing you the results you expect, then I'll need to see the request URLs you're sending in order to be able to help further. You can run the python script and copy the URLs from the terminal.
 
As a side-note, URL channels only work when pre-defined for specific URLs inside the AdSense account. And you can only create a limited number of them. AdSense recently launched a new feature inside reporting which shows you the URL-level breakdown of reports. Go to the reports page in AdSense, and choose the "Page URL" dimension. Note that this dimension only shows URLs that have sufficient traffic, and data is only stored for the past 30 days. You can learn more about this dimension here:
https://support.google.com/adsense/answer/11988478
 
All the best!
ref:_00D1U1174p._5004Q2f4PJK: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.

Tuesday, October 11, 2022

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

Stefan Djurovic <stefandjurovic1998@gmail.com>: Oct 08 02:53AM -0700

I'm looking into extracting earnings per specific URL but just can't pull
it off.
 
In simple terms want to use these URL_CHANNEL_NAME as dimensions, and
ESTIMATED_EARNINGS as a metric.
 
I'm using Python and followed this sample as a reference:
https://github.com/googleads/googleads-adsense-examples/blob/main/v2/python/generate_report.py
 
Tried to create a saved report with URLs, then pull it via the API but
still end up with the same error message.
 
Did someone encounter these issues as well?
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.