是否可以使用Google Analytics(分析)API获取任何网站(而非我的网站)的Google Analytics(分析)数据?

问题描述:

是否可以使用Google Analytics(分析)API获取任何网站(不是我的网站)的Google Analytics(分析)数据?

Is it possible to get Google Analytics data for any website (not my website) using Google Analytics API?

我已经为Google Analytics(分析)创建了Google API.然后,我尝试访问其他配置文件ID的Google Analytics(分析)数据.

I have created Google API for Google Analytics. Then I am trying to access the Google Analytics data for a different profile id.

它适用于我的个人资料ID,但不适用于其他用户的个人资料ID.

It is working for my profile id but not other user's profile id.

Google Analytics(分析)API依赖于[OAuth 2.0]( https://support.google.com/analytics/answer/1009618?hl=zh_CN ).所以例如如果您的Google Analytics(分析)帐户是通过电子邮件ID foo@gmail.com链接的,则用于查询的配置文件ID必须与您的Google Analytics(分析)帐户中的实际配置文件相对应.这就是为什么随机配置文件ID无效的原因.

The Google Analytics API relies on [OAuth 2.0] (https://developers.google.com/analytics/devguides/reporting/core/v3/gdataAuthorization) for authorization. This simply means that the data extraction module you created needs explicit permission to access a Google Analytics Account. Moreover, the scenario you describe about using a different Profile ID wouldn't work due to the nature in which Accounts and Profiles (Views) are [related] (https://support.google.com/analytics/answer/1009618?hl=en) to each other in Google Analytics. So for e.g. if your Google Analytics Account is linked via your email id foo@gmail.com, the profile ID that you use to query must correspond to an actual profile in your Google Analytics account. This is the reason why a random Profile ID wouldn't work.