Google Analytics Embed API:如何自动验证? [英] Google Analytics Embed API: How to Auto-Authenticate?

查看:76
本文介绍了Google Analytics Embed API:如何自动验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google Analytics(分析)Embed API将一些GA数据嵌入自定义信息中心.我正在使用演示站点中的方法:

I'm using the Google Analytics Embed API to embed some GA data on a custom dashboard. I'm using the method from the demo site:

https://ga-dev-tools.appspot.com/embed-api /

gapi.analytics.auth.authorize({
   container: 'embed-api-auth-container',
   clientid: 'MY CLIENT ID',
});

工作正常.但这要求用户进行身份验证,然后才能看到数据.如何解决此问题或使用此方法自动进行身份验证(这样,任何可以访问该页面的人都不必登录)?

Works fine. But it requires the user to authenticate before they can see the data. How do I get around this or auto-authenicate using this method (so anyone that can access the page doesn't have to login)?

在这一点上,一个代码示例将是理想的.感谢您提供的任何帮助.

A code example would be ideal at this point. Thank you for any help you can provide.

推荐答案

本质上,您是在询问代表访问者对服务器端进行授权.

Essentially, you're asking about authorizing server side on behalf of your visitors.

以前已经问过这个问题的各种形式,所以我只给您发送一些链接,而不是重新回答:

Various forms of this question have been asked before, so rather than re-answer I'll just send you some links:

  • Using Google Analytics to show subset of data for customers of web application using embed api
  • Google Analytics Embed API: How to retireve access token?

这是auth方法的文档,其中讨论了serverAuth选项:
https://developers.google.com/analytics/devguides/reporting/embed/v1/component-reference#auth

And here's the documentation for the auth method, which discusses the serverAuth option:
https://developers.google.com/analytics/devguides/reporting/embed/v1/component-reference#auth

这篇关于Google Analytics Embed API:如何自动验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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