0

While migrating from an older version, I ran into a problem with the reports pulling.

The same report from v1.4 isn't return any data in v2:

v1.4 report scrape:

self.service.accounts().reports().generate(
                accountId=account_id, startDate=start_date.strftime(self.DATE_FORMAT),
                endDate=end_date.strftime(self.DATE_FORMAT),
                metric=metrics, dimension=dimensions).execute()

GET https://www.googleapis.com/adsense/v1.4/accounts/pub-***/reports?startDate=2021-06-13&metric=REACHED_AD_REQUESTS&metric=CLICKS&metric=EARNINGS&metric=VIEWED_IMPRESSIONS&metric=MATCHED_REACHED_AD_REQUESTS&endDate=2021-06-13&dimension=DATE&dimension=APP_NAME&dimension=APP_ID&dimension=APP_PLATFORM&dimension=BID_TYPE_CODE&dimension=PRODUCT_NAME&dimension=COUNTRY_NAME&dimension=AD_UNIT_CODE&dimension=AD_UNIT_NAME&dimension=AD_UNIT_SIZE_NAME&dimension=AD_UNIT_SIZE_CODE&dimension=REACHED_AD_REQUESTS&alt=json

Response:

{u'averages': ...,
 u'endDate': u'2021-06-13',
 u'headers': [{u'name': u'DATE', u'type': u'DIMENSION'},
  {u'name': u'APP_NAME', u'type': u'DIMENSION'},
  {u'name': u'APP_ID', u'type': u'DIMENSION'},
  {u'name': u'APP_PLATFORM', u'type': u'DIMENSION'},
  {u'name': u'BID_TYPE_CODE', u'type': u'DIMENSION'},
  {u'name': u'PRODUCT_NAME', u'type': u'DIMENSION'},
  {u'name': u'COUNTRY_NAME', u'type': u'DIMENSION'},
  {u'name': u'AD_UNIT_CODE', u'type': u'DIMENSION'},
  {u'name': u'AD_UNIT_NAME', u'type': u'DIMENSION'},
  {u'name': u'AD_UNIT_SIZE_NAME', u'type': u'DIMENSION'},
  {u'name': u'AD_UNIT_SIZE_CODE', u'type': u'DIMENSION'},
  {u'name': u'REACHED_AD_REQUESTS', u'type': u'METRIC_TALLY'},
  {u'name': u'CLICKS', u'type': u'METRIC_TALLY'},
  {u'currency': u'USD', u'name': u'EARNINGS', u'type': u'METRIC_CURRENCY'},
  {u'name': u'VIEWED_IMPRESSIONS', u'type': u'METRIC_TALLY'},
  {u'name': u'MATCHED_REACHED_AD_REQUESTS', u'type': u'METRIC_TALLY'}],
 u'kind': u'adsense#report',
 u'rows': ...
u'startDate': u'2021-06-13',
 u'totalMatchedRows': u'10069',
 u'totals': ...,
u'warnings': [u'Some of the requested ad clients do not support the requested combination of dimensions.',
  u'Some of the requested ad clients do not support the requested combination of dimensions.']}

v2 report scrape:

self.service.accounts().reports().generate(
                account='accounts/' + account_id, dateRange="CUSTOM",
                startDate_year=start_date.year, startDate_month=start_date.month, startDate_day=start_date.day,
                endDate_year=end_date.year, endDate_month=end_date.month, endDate_day=end_date.day,
                metrics=metrics, dimensions=dimensions).execute()

GET https://adsense.googleapis.com/v2/accounts/pub-***/reports:generate?startDate.month=6&endDate.day=13&dimensions=DATE&dimensions=PRODUCT_NAME&dimensions=PLATFORM_TYPE_NAME&dimensions=BID_TYPE_CODE&dimensions=COUNTRY_NAME&dimensions=AD_UNIT_ID&dimensions=AD_UNIT_NAME&dimensions=AD_UNIT_SIZE_NAME&dimensions=AD_UNIT_SIZE_CODE&endDate.month=6&startDate.year=2021&startDate.day=13&metrics=AD_REQUESTS&metrics=CLICKS&metrics=TOTAL_EARNINGS&metrics=TOTAL_IMPRESSIONS&metrics=MATCHED_AD_REQUESTS&endDate.year=2021&alt=json&dateRange=CUSTOM

Response:

{u'endDate': {u'day': 13, u'month': 6, u'year': 2021},
 u'headers': [{u'name': u'DATE', u'type': u'DIMENSION'},
  {u'name': u'PRODUCT_NAME', u'type': u'DIMENSION'},
  {u'name': u'PLATFORM_TYPE_NAME', u'type': u'DIMENSION'},
  {u'name': u'BID_TYPE_CODE', u'type': u'DIMENSION'},
  {u'name': u'COUNTRY_NAME', u'type': u'DIMENSION'},
  {u'name': u'AD_UNIT_ID', u'type': u'DIMENSION'},
  {u'name': u'AD_UNIT_NAME', u'type': u'DIMENSION'},
  {u'name': u'AD_UNIT_SIZE_NAME', u'type': u'DIMENSION'},
  {u'name': u'AD_UNIT_SIZE_CODE', u'type': u'DIMENSION'},
  {u'name': u'AD_REQUESTS', u'type': u'METRIC_TALLY'},
  {u'name': u'CLICKS', u'type': u'METRIC_TALLY'},
  {u'currencyCode': u'USD',
   u'name': u'TOTAL_EARNINGS',
   u'type': u'METRIC_CURRENCY'},
  {u'name': u'TOTAL_IMPRESSIONS', u'type': u'METRIC_TALLY'},
  {u'name': u'MATCHED_AD_REQUESTS', u'type': u'METRIC_TALLY'}],
 u'startDate': {u'day': 13, u'month': 6, u'year': 2021},
 u'warnings': [u'Some of the requested dimensions (or their combination) do not apply to some of the ad clients used by this report.',
  u'Some of the requested metrics are not available for some of the ad clients used by this report.']}

also checked the python example, but everything is the same.

will send the account_id in private if needed.

*Using python packages for AdSense Management API(googleapiclient, oauth2client).

Thanks

1 Answers1

0

Is this an AdSense account or an AdMob account? I noticed that you're using some "APP" Dimensions in your first report. From the v2 release notes "Report" section: "AdMob and YouTube properties are no longer supported." If this is an AdMob property, you should migrate to the AdMob API.