Google Analytics API - 获取特定 URL 的页面查看信息 [英] Google Analytics API - Get page view information for specific URLs

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

问题描述

我希望在我的一个网站上实施页面浏览跟踪系统.

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

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

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 :

总浏览量 |今天总计 |本周 |本月 |今年

数据是否完全是最新的并不重要.

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

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

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.

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

I am using PHP and MySQL on the server.

推荐答案

是的 - 您需要为此使用 Google Analytics API.我建议查看查询资源管理器,以了解您需要创建的查询.

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.

您将需要多次查询才能获得所需的所有数据(调整开始日期):- 总浏览- 今年- 这个月- 本周(即过去 7 天 - 您也可以从中获得今天的总数).

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).

这是一个示例查询:

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 版本,它将完全满足您的需求(您编写调用脚本以传递页面路径).我们已经在许多播客共享网站上做过类似的事情.

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 - 获取特定 URL 的页面查看信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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