2017-02-24 14:02
浏览 40

Google Analytics报告Api - PHP:添加用户帐户

What I want to do

  • Let user of my web application share their analytics account with the app.
  • Redirect the user to Google authentication which ask them to approve access
  • Redirect the user back to the app.
  • Generate a report for the user based on his analytics data and data from the app.
  • Next time the user will generate their report I don't want to ask them for the logging again.

Where the problem is

I read this Google developers PHP guide. However, the sample code connects to first account that is already shared with the app.

I want to see a piece of code that ask user for their credentials and consequently provides access to their account.

On Stack I've already found this answer Service Applications and Google Analytics API V3: Server-to-server OAuth2 authentication?. However, mentioned APP_EMAIL is not a particular user's e-mail, but developer.gserviceaccount.com identification for the app created in the console.

Also I found this thread Google Analytics Core Reporting API Version 3.0 without client login. It seems that similar topic is solved there, but the important part of code (from my point of view) is missing there.

图片转代码服务由CSDN问答提供 功能建议


    \ n
  • 让我的网络应用程序的用户与该应用程序共享他们的分析帐户。
  • 将用户重定向到Google身份验证,要求他们批准访问权限
  • 重定向 用户返回应用程序。
  • 根据用户的分析数据和数据为用户生成报告。
  • 下次用户生成报告时我 不想让他们再次登录。


    我读了这篇 Google开发人员PHP指南 。 但是,示例代码连接到已与应用程序共享的第一个帐户。


    在堆栈上我已经找到了这个答案服务应用程序和Google AnalyticsAPI V3:服务器到服务器OAuth2身份验证?。 但是,提到的APP_EMAIL不是特定用户的电子邮件,而是在控制台中创建的应用程序的developer.gserviceaccount.com标识。

    此外,我发现此主题 Google Analytics Core Reporting API 3.0版,无需客户端登录。 似乎在那里解决了类似的主题,但代码的重要部分(从我的角度来看)在那里缺失。

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题