简体   繁体   English

如何从我的Google Analytics(分析)帐户提取数据以在网站上使用?

[英]How to fetch data from my google analytics account to use on site?

Consider that I am owner of http://ethernalsite.com 认为我是http://ethernalsite.com的所有者

On my website i've added google analytics script and it's happily collecting data about my precious visitors. 在我的网站上,我添加了Google Analytics(分析)脚本,它很高兴地收集了有关我的宝贵访客的数据。
I would like to create page views counter. 我想创建浏览量计数器。 How I can fetch data from my own account? 如何从自己的帐户中获取数据?
I mean, from site's account on which data is collected. 我的意思是,从网站的帐户中收集数据。

I've tried this: 我已经试过了:

  1. create browser token on google's developer console and allow access for ethernalsite.com/* 在Google开发人员控制台上创建浏览器令牌 ,并允许访问ethernalsite.com/*
    I've got something like: xxxxSyCl5wAzQVSxxxxxKHFcxn6Uxzi-skoFZgo 我有类似的东西:xxxxSyCl5wAzQVSxxxxxKHFcxn6Uxzi-skoFZgo

  2. make ajax get on client(javascript) side: https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3A00263622&metrics=ga%3AuniquePageviews&start-date=2014-08-19&end-date=2014-09-02&max-results=50&key= 使ajax进入客户端(javascript)端: https : //www.googleapis.com/analytics/v3/data/ga?ids= ga%3A00263622&metrics=ga%3AuniquePageviews&start-date=2014-08-19&end-date =2014- 09-02&max-results = 50&key = {KEY} {键}

I've got the following response for ajax get query(firebug) 我对ajax get query(firebug)有以下响应

"NetworkError: 401 Unauthorized - https://www.googleapis.com/analytics/v3/data
/ga?ids=ga%3A00263622&metrics=ga%3AuniquePageviews&start-date=2014-08-19&
end-date=2024-09-02&max-results=50&key=xxxxSyCl5wAzQVSxxxxxKHFcxn6Uxzi-skoFZgo"

With content: 带有内容:

{"error":{"errors":[{"domain":"global","reason":"required",
"message":"LoginRequired","locationType":"header","location":"Authorization"}],
"code":401,"message":"Login Required"}}

In the future I would like to cache this value in the server side and allow client to fetch this data from my server every minute. 将来,我想将此值缓存在服务器端,并允许客户端每分钟从我的服务器获取此数据。 If you also have tips about solving this problem using python i would be grateful. 如果您还有使用python解决此问题的技巧,我将不胜感激。

The Google Developer Console will only give you the CLIENT_ID and CLIENT_SECRET. Google Developer Console仅会为您提供CLIENT_ID和CLIENT_SECRET。 With these keys you will be able to generate an ACCESS_TOKEN and you will have to change your query string to 使用这些键,您将能够生成ACCESS_TOKEN,并且必须将查询字符串更改为

?ids=ga%3A00263622&metrics=ga%3AuniquePageviews&start-date=2014-08-19&end-date=2024-09-02&max-results=50&access_key=xxxxACCESS_KEYxxxx&_src=explorer

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法从我的Google Analytics(分析)帐户中获取数据到google docs - Cannot fetch data from my Google analytics account to a google docs 如何从我的谷歌分析帐户获取通过 js 传递的自定义维度数据? - How to get the custom dimension data passed through js, from my google analytics account? 如何使用Google Analytics(分析)中的数据显示我网站上的页面访问? - How to display page visits in my web site using data from Google Analytics? 在我的网站上显示 Google Analytics 数据? - Display Google Analytics data on my web site? 如何从 Google Analytics 探索表单中获取数据 - How to fetch the data from the Google Analytics explore Form 从网站内部访问Google Analytics(分析)数据 - Accessing Google Analytics data from within site Google Analytics(分析):在我的网站上的报告中显示数据时,我可以使用自定义维度名称代替索引吗 - Google analytics : Can I use custom dimension name instead of index while showing data on Report On my Site PHP代码,用于从Google Analytics(分析)帐户检索数据 - PHP code for retrieving data from a google analytics account 如何实现Google Analytics(分析)API以获取我现有Google Analytics(分析)帐户的报告? - How to implement google Analytics API to get reports Of my existing Google Analytics Account? 如何从 Google Firestore 获取数据到我的 Vue 实例中? - How to fetch data from Google Firestore into my Vue instance?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM