Google Analytics API - 获取特定网址的网页浏览信息 [英] Google Analytics API - Get page view information for specific URLs

查看:112
本文介绍了Google Analytics API - 获取特定网址的网页浏览信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在我的某个网站上实施页面视图跟踪系统。



该网站是供应商可以宣传其服务的目录。供应商在网站上有一个独特的档案页面,例如mysite.com/directory/abc-profile.html



这个想法是供应商可以登录到他们的账户区域该网站并查看有多少人访问其个人资料的统计信息。理想情况下,我想将其显示为:



总观看次数|今日总计|本周|本月|今年



数据是否完全保持最新并不重要。



我已经在网站上安装了Google Analytics(分析)跟踪代码。是否可以使用Google Analytics API来检索这些数据?如果是这样,我需要做什么样的查询?我查看了文档,但无法确定函数是否允许这样做。



我在服务器上使用PHP和MySQL。

解决方案

是的 - 您需要为此使用Google Analytics API。我建议查看查询浏览器,以了解您需要创建的查询。

您需要许多查询才能获取所需的所有数据(调整开始日期):
- 总视图
- 今年
- 本月
- 本周(即最近7天 - 您可以从中获得今日总额)。

以下是一个查询示例: / p>

  https://www.googleapis.com/analytics/v3/data/ga?ids=ga:1234456789&dimensions=ga :pagePath& metrics = ga:pageviews& filters = ga:pagePath == / about-us.html& start-date = 2013-10-15& end-date = 2013-10-29& max-results = 50 

或者,您可能需要考虑 www.embeddedanalytics.com 披露 - 我与他们合作)。我们有一个服务/平台,允许网站所有者嵌入基于GA的图表/统计数据,而无需学习GA API。我们有一个CMS版本,可以完全满足您的需求(您将脚本编写为传递页面路径的脚本)。我们通过多个播客分享网站完成了类似的工作。

I am looking to implement a page view tracking system on one of my websites.

The website is a directory where suppliers can advertise their services. Suppliers have a unique profile page on the site, e.g mysite.com/directory/abc-profile.html

The idea is that suppliers can log in to their account area on the site and view stats on how many people are visiting their profile. Ideally I want to display this as :

Total views | Total today | This week | This month | This year

It does not matter if the data is not completely up to date.

I already have Google Analytics tracking code installed on the site. Is it possible to use the Google Analytics API to retrieve this data? If so, what kind of query do I need to make? I had a look on the documentation but could not figure whether the functions allow this or not.

I am using PHP and MySQL on the server.

解决方案

Yes - you will need to use the Google Analytics API for this. I would suggest checking out the Query Explorer to get a feel for the queries you will need to create.

You will require numerous queries to get all the data you need (adjusting the starting date): - Total Views - This Year - This Month - This Week (i.e. last 7 days - from which you could also get Total Today).

Here is an example query:

https://www.googleapis.com/analytics/v3/data/ga?ids=ga:1234456789&dimensions=ga:pagePath&metrics=ga:pageviews&filters=ga:pagePath==/about-us.html&start-date=2013-10-15&end-date=2013-10-29&max-results=50

Alternatively, you might want to consider www.embeddedanalytics.com (disclosure - I work with them). We have a service/platform that allows website owners to embed GA based charts/statistics without having to learn the GA API. We have a CMS version which will do exactly what you need (where you script the call to pass the page path). We have done something like this with a number of podcast sharing sites.

这篇关于Google Analytics API - 获取特定网址的网页浏览信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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