Google 分析:执行 API 并进行身份验证

Google analytics : Execute API with authentication

根据 querybuilder

我的 API URI 看起来:

https://www.googleapis.com/analytics/v3/data/ga?ids=ga:12134345&
   start-date=30daysAgo
   &end-date=yesterday&
   metrics=ga:pageviews,ga:pageValue,ga:entrances&
   dimensions=ga:pagePath,ga:daysSinceLastSession,ga:sessionCount,ga%3
   Abrowser,ga:city&filters=ga:pagePath==/home

But when i execute in my domain, it throws error as login required. So for that i also passed API-KEY as &key="****" to the above url. But still no success. Still i get the same error

我错过了什么吗?我可以将此结果嵌入到图表

中嵌入-api

api 密钥与访问令牌不同。如果您使用查询资源管理器,您可以在报告中选中一个框以将访问令牌包含在查询 URI 中,这样您就可以将其粘贴到浏览器的地址栏中(注意:访问令牌在一小时后过期)。

如果您想了解如何以编程方式获取访问令牌,您应该查看 Google 开发者网站的 OAuth 2.0 部分: https://developers.google.com/identity/protocols/OAuth2