I can't use URL_CHANNEL_NAME dimension, leads to HTTP 400

53 views
Skip to first unread message

Stefan Djurovic

unread,
Oct 10, 2022, 9:14:31 AM10/10/22
to AdSense API Forum
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?


Ad Sense API

unread,
Oct 12, 2022, 7:57:07 AM10/12/22
to stefandju...@gmail.com, adsen...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages