显示谷歌Analytics的数据实时 [英] Showing Google Analytics Data in real time

查看:276
本文介绍了显示谷歌Analytics的数据实时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想显示在网站上参观人数自本月初以来开始,在当天,目前在现场的用户数。

I would like to show number of visitors on a site since beginning of the month, number of users on the current day and currently on site.

我已经安装了谷歌分析,我试图实现从开发者控制台谷歌Analytics(分析)API来解决API嵌入这个问题 - 但我需要用户授权等。

I have Google Analytics installed, I tried to solve this issue with Embed API by enabling Google Analytics API from developer console - but I requires user authorization, etc.

什么是展示,而无需用户认证现场分析和嵌入式API等应用程序是用角接受访问,因此JavaScript API第是一个我寻找最简单的方法。

What would be the easiest way to show analytics on-site without user authentication and accepting access by Embeded API, etc. Application is written in Angular, so Javascript API is the one I look for.

感谢您的任何建议。

推荐答案

授权是为了得到你想要的数据的情况发生。要么你可以让您的网站访问者授权自己,或者你就必须代表他们授权的服务器端。

Authorization has to happen in order to get the data you want. Either you can let visitors to your site authorize themselves, or you'll have to authorize server-side on their behalf.

一旦授权,你可以做类似的东西什么的第三方可视化嵌入API演示节目。它使用一个自定义的 ActiveUsers API嵌入组件,包括源$ C ​​$ C来显示它是如何工作的。

Once authorized, you can do something similar to what the Third Party Visualization Embed API demo shows. It uses a custom ActiveUsers Embed API component and includes the source code to show how it works.

您是否使用 ActiveUsers 组件与否,基本要点是,一旦用户通过嵌入API进行身份验证,您可以访问该方法 gapi.client.analytics.data.realtime.get ,您可以用它来查询数据。

Whether you use the ActiveUsers component or not, the basic gist is that once the users is authenticated via the Embed API, you have access to the method gapi.client.analytics.data.realtime.get, which you can use to query this data.

在此处,在源$ C ​​$ C为 ActiveUsers 组件出现这种情况:结果
<一href=\"https://github.com/googleanalytics/ga-dev-tools/blob/master/src/javascript/embed-api/components/active-users.js#L69-L87\" rel=\"nofollow\">https://github.com/googleanalytics/ga-dev-tools/blob/master/src/javascript/embed-api/components/active-users.js#L69-L87

Here's where that happens in the source code for the ActiveUsers component:
https://github.com/googleanalytics/ga-dev-tools/blob/master/src/javascript/embed-api/components/active-users.js#L69-L87

这篇关于显示谷歌Analytics的数据实时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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