问题
Is it possible to get Google Analytics data for any website (not my website) using Google Analytics API?
I have created Google API for Google Analytics. Then I am trying to access the Google Analytics data for a different profile id.
It is working for my profile id but not other user's profile id.
回答1:
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.
回答2:
No. You need to be granted permission to the account or view to access it. GA has documentation here
来源:https://stackoverflow.com/questions/25664055/is-it-possible-to-get-google-analytics-data-for-any-website-not-my-website-usi