Google Analytics API v3 授权以允许访问我的数据 [英] Google Analytics API v3 authorization to allow access to my data

查看:33
本文介绍了Google Analytics API v3 授权以允许访问我的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一款应用,允许用户使用 Google API v3 查看我自己的 Google Analytics 数据.我研究的所有内容似乎都表明用户需要登录他们的 Google 帐户并授予我的应用访问权限,然后我才能开始查询 API;然而,这不是我想要的,我只需要我的用户看到我自己的 Analytics 数据.如何授权 API 访问我的数据.我有客户端 ID 和客户端密钥,但由 Google 的 API v3 实现的 OAuth 要求提供授权令牌,只能通过让用户登录其 Google 帐户来获得(是吗?)有没有办法只登录我自己的 Google Analytics(分析)帐户并向用户显示该信息?

I am developing an app that allows users to see my own Google Analytics Data using Google API v3. Everything I researched seems to indicate that users need to login into their Google accounts and grant my app the access before I can start querying the API; however, that's not what I want, I just need my users to see my own Analytics data. How can authorize the API to access my data. I have the client ID and Client Secret, but the OAuth that's implemented by Google's API v3 is asking for an authorization token, which can only be obtained by getting the user to login into their google account (is that right?) Is there a way to just login into my own Google Analytics account and display that information to the users?

推荐答案

我相信你想做的是建立一个服务帐号:https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtAuthorization

I believe what you want to do is set up a Service Account: https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtAuthorization

对于为您自己的帐户自动/离线/计划访问 Google Analytics 数据很有用.例如,构建您自己的 Google Analytics 数据的实时仪表板并与其他用户共享.

"Useful for automated/offline/scheduled access to Google Analytics data for your own account. For example, to build a live dashboard of your own Google Analytics data and share it with other users.

要配置服务帐户以使用 Google Analytics(分析),您需要遵循几个步骤:

There are a few steps you need to follow to configure service accounts to work with Google Analytics:

  1. 在 API 控制台中注册一个项目.
  2. 在 Google API 控制台的 API 访问窗格下,创建一个应用程序类型设置为服务帐户的客户端 ID.
  3. 登录 Google Analytics(分析)并导航到管理"部分.
  4. 选择您希望应用程序访问的帐户
  5. 从 API 中创建的客户端 ID 添加电子邮件地址来自第 2 步的控制台,作为所选 Google Analytics 的用户帐户.
  6. 按照服务帐户的说明访问 Google Analytics 数据:https://developers.google.com/accounts/docs/OAuth2ServiceAccount"

这篇关于Google Analytics API v3 授权以允许访问我的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆