刮从谷歌Analytics(分析)实时访客 [英] Scraping Real Time Visitors from Google Analytics

查看:210
本文介绍了刮从谷歌Analytics(分析)实时访客的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多的网站,并希望建立一个仪表盘显示的实时游客数量对他们每个人在一个页面上。 (将任何人想要这个?)现在唯一的方式来查看这些信息是打开一个新的标签为每个站点。

I have a lot of sites and want to build a dashboard showing the number of real time visitors on each of them on a single page. (would anyone else want this?) Right now the only way to view this information is to open a new tab for each site.

谷歌不具备实时API,所以我不知道是否可以凑这个数据。爱德华Cereto发现,谷歌在实时/绑定的网络要求传输的实时数据。任何人都更精明有我应该如何开始的想法?下面是我在想什么:

Google doesn't have a real-time API, so I'm wondering if it is possible to scrape this data. Eduardo Cereto found out that Google transfers the real-time data over the realtime/bind network request. Anyone more savvy have an idea of how I should start? Here's what I'm thinking:

  1. 在弄清楚如何以编程方式验证
  2. 检查所有的实时/绑定的请求的,看看他们是如何变化的。是否每个请求有一个唯一的钥匙吗?哪里是从何而来?下面是我的要求分解:

  1. Figure out how to authenticate programmatically
  2. Inspect all of the realtime/bind requests to see how they change. Does each request have a unique key? Where does that come from? Below is my breakdown of the request:

<一个href="https://www.google.com/analytics/realtime/bind?VER=8">https://www.google.com/analytics/realtime/bind?VER=8

&放大器;关键= [这是什么?它从何而来? 21字小写字母和数字,保持不变的每个请求]

&放大器; DS = [这是什么?它从何而来? 21字小写字母和数字,保持不变的每个请求]

&ds=[What is this? Where does it come from? 21 character lowercase alphanumeric, stays the same each request]

&放大器; PAGEID = RT标%2Frt-概述

&pageId=rt-standard%2Frt-overview

&q=t%3A0%7C%3A1%3A0%3A%2Ct%3A11%7C%3A1%3A5%3A%2Cot%3A0%3A0%3A4%2Cot%3A0%3A0%3A3%2Ct%3A7%7C%3A1%3A10%3A6%3D%3DREFERRAL%3B%2Ct%3A10%7C%3A1%3A10%3A%2Ct%3A18%7C%3A1%3A10%3A%2Ct%3A4%7C5%7C2%7C%3A1%3A10%3A2!%3Dzz%3B%2C&f

&q=t%3A0%7C%3A1%3A0%3A%2Ct%3A11%7C%3A1%3A5%3A%2Cot%3A0%3A0%3A4%2Cot%3A0%3A0%3A3%2Ct%3A7%7C%3A1%3A10%3A6%3D%3DREFERRAL%3B%2Ct%3A10%7C%3A1%3A10%3A%2Ct%3A18%7C%3A1%3A10%3A%2Ct%3A4%7C5%7C2%7C%3A1%3A10%3A2!%3Dzz%3B%2C&f

在Q变量URI德codeS这个(是什么?): t:0|:1:0:,t:11|:1:5:,ot:0:0:4,ot:0:0:3,t:7|:1:10:6==REFERRAL;,t:10|:1:10:,t:18|:1:10:,t:4|5|2|:1:10:2!=zz;,&f

The q variable URI decodes to this (what the?): t:0|:1:0:,t:11|:1:5:,ot:0:0:4,ot:0:0:3,t:7|:1:10:6==REFERRAL;,t:10|:1:10:,t:18|:1:10:,t:4|5|2|:1:10:2!=zz;,&f

&放大器; RID = RPC

&RID=rpc

&放大器; SID = [这是什么?它从何而来? 16字符大写字母,保持不变的每个请求]

&SID=[What is this? Where does it come from? 16 character uppercase alphanumeric, stays the same each request]

&放大器; CI = 0

&CI=0

&放大器; AID = [这是什么?它从何而来?整数,从1开始,增量古怪到150,然后298]

&AID=[What is this? Where does it come from? integer, starts at 1, increments weirdly to 150 and then 298]

&放大器; TYPE = XMLHTTP

&TYPE=xmlhttp

&放大器; ZX = [这是什么?它从何而来? 12个字符的小写字母和数字,改变每个请求]

&zx=[What is this? Where does it come from? 12 character lowercase alphanumeric, changes each request]

&amp; T公司= 1

&t=1

检查所有的实时/绑定的响应的,看看他们是如何变化的。如何进来的数据?它看起来像一些改变JSON。多少次,我需要连接到获取数据?凡在现场数了活跃的游客在那里?下面是样本数据的转储:

Inspect all of the realtime/bind responses to see how they change. How does the data come in? It looks like some altered JSON. How many times do I need to connect to get the data? Where is the active visitors on site number in there? Here is a dump of sample data:

19 [151,[空操作] ] ] 388 [[152,["rt",[{"ot:0:0:4":{"timeUnit":"MINUTES","overTimeData":[{"values":[49,53,52,40,42,55,49,41,51,52,47,42,62,82,76,71,81,66,81,86,71,66,65,65,55,51,53,73,71,81],"name":"Total"}]},"ot:0:0:3":{"timeUnit":"SECONDS","overTimeData":[{"values":[0,1,1,1,1,0,1,0,1,1,1,0,2,0,2,2,1,0,0,0,0,0,2,1,1,2,1,2,0,5,1,0,2,1,1,1,2,0,2,1,0,5,1,1,2,0,0,0,0,0,0,0,0,0,1,1,0,3,2,0],"name":"Total"}]}}]]] ] 388 [[153,["rt",[{"ot:0:0:4":{"timeUnit":"MINUTES","overTimeData":[{"values":[52,53,52,40,42,55,49,41,51,52,47,42,62,82,76,71,81,66,81,86,71,66,65,65,55,51,53,73,71,81],"name":"Total"}]},"ot:0:0:3":{"timeUnit":"SECONDS","overTimeData":[{"values":[2,1,1,1,1,1,0,1,0,1,1,1,0,2,0,2,2,1,0,0,0,0,0,2,1,1,2,1,2,0,5,1,0,2,1,1,1,2,0,2,1,0,5,1,1,2,0,0,0,0,0,0,0,0,0,1,1,0,3,2],"name":"Total"}]}}]]] ] 388 [[154,["rt",[{"ot:0:0:4":{"timeUnit":"MINUTES","overTimeData":[{"values":[53,53,52,40,42,55,49,41,51,52,47,42,62,82,76,71,81,66,81,86,71,66,65,65,55,51,53,73,71,81],"name":"Total"}]},"ot:0:0:3":{"timeUnit":"SECONDS","overTimeData":[{"values":[0,3,1,1,1,1,1,0,1,0,1,1,1,0,2,0,2,2,1,0,0,0,0,0,2,1,1,2,1,2,0,5,1,0,2,1,1,1,2,0,2,1,0,5,1,1,2,0,0,0,0,0,0,0,0,0,1,1,0,3],"name":"Total"}]}}]]] ]

19 [[151,["noop"] ] ] 388 [[152,["rt",[{"ot:0:0:4":{"timeUnit":"MINUTES","overTimeData":[{"values":[49,53,52,40,42,55,49,41,51,52,47,42,62,82,76,71,81,66,81,86,71,66,65,65,55,51,53,73,71,81],"name":"Total"}]},"ot:0:0:3":{"timeUnit":"SECONDS","overTimeData":[{"values":[0,1,1,1,1,0,1,0,1,1,1,0,2,0,2,2,1,0,0,0,0,0,2,1,1,2,1,2,0,5,1,0,2,1,1,1,2,0,2,1,0,5,1,1,2,0,0,0,0,0,0,0,0,0,1,1,0,3,2,0],"name":"Total"}]}}]]] ] 388 [[153,["rt",[{"ot:0:0:4":{"timeUnit":"MINUTES","overTimeData":[{"values":[52,53,52,40,42,55,49,41,51,52,47,42,62,82,76,71,81,66,81,86,71,66,65,65,55,51,53,73,71,81],"name":"Total"}]},"ot:0:0:3":{"timeUnit":"SECONDS","overTimeData":[{"values":[2,1,1,1,1,1,0,1,0,1,1,1,0,2,0,2,2,1,0,0,0,0,0,2,1,1,2,1,2,0,5,1,0,2,1,1,1,2,0,2,1,0,5,1,1,2,0,0,0,0,0,0,0,0,0,1,1,0,3,2],"name":"Total"}]}}]]] ] 388 [[154,["rt",[{"ot:0:0:4":{"timeUnit":"MINUTES","overTimeData":[{"values":[53,53,52,40,42,55,49,41,51,52,47,42,62,82,76,71,81,66,81,86,71,66,65,65,55,51,53,73,71,81],"name":"Total"}]},"ot:0:0:3":{"timeUnit":"SECONDS","overTimeData":[{"values":[0,3,1,1,1,1,1,0,1,0,1,1,1,0,2,0,2,2,1,0,0,0,0,0,2,1,1,2,1,2,0,5,1,0,2,1,1,1,2,0,2,1,0,5,1,1,2,0,0,0,0,0,0,0,0,0,1,1,0,3],"name":"Total"}]}}]]] ]

让我知道如果你能帮助任何以上的项目!

Let me know if you can help with any of the items above!

推荐答案

要获得相同的,谷歌已经推出了新的实时API。通过这个API,你可以轻松地检索实时在线访问者以及一些谷歌Analytics(分析)以下维度和指标。 <一href="https://developers.google.com/analytics/devguides/reporting/realtime/dimsmets/">https://developers.google.com/analytics/devguides/reporting/realtime/dimsmets/

To get the same, Google has launched new Real Time API. With this API you can easily retrieve real time online visitors as well as several Google Analytics with following dimensions and metrics. https://developers.google.com/analytics/devguides/reporting/realtime/dimsmets/

这是非常类似谷歌Analytics(分析)API。要启动这方面的发展, <一href="https://developers.google.com/analytics/devguides/reporting/realtime/v3/devguide">https://developers.google.com/analytics/devguides/reporting/realtime/v3/devguide

This is quite similar to Google Analytics API. To start development on this, https://developers.google.com/analytics/devguides/reporting/realtime/v3/devguide

这篇关于刮从谷歌Analytics(分析)实时访客的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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