Google.Apis.Requests.RequestError for AdSense/Publ

2019-07-21 02:29发布

问题:

Since yesterday, we have trouble getting data from the Analytics API for AdSense related metrics (ga:adsensePageImpressions, ga:adsenseAdsViewed, ga:adsenseCoverage etc.). Other metric like ga:sessions are still working.

Is this some permission problem?

From the main account, I can log into Analytics, and I do see current AdSense (Publisher) data.

.NET, Google.Apis.Analytics.V3 1.20.0.642 (up to date), Google.Apis.AnalyticsReporting.v4 1.20.0.698. Tried with V3 and V4, same error.

We are using a service account that has permission to access Analytics data. I’ve checked AdSense, Analytics, and API Management settings, but cannot find anything related.

Any suggestions?

回答1:

It looks like they have updated Analytics API and it's no longer possible to call API with AdSense/Publisher metrics for Analytics properties that do not have linked AdSense account.

Unfortunately, in cases where there are hundreds of sites and where some of the sites have AdSense, and other do not, you have to create different API calls for those two groups.