获取 Google Analytics“访问者流量"来自 API 的数据 [英] Get Google Analytics "Visitors Flow" data from API

查看:27
本文介绍了获取 Google Analytics“访问者流量"来自 API 的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 Google Analytics 收集信息来为我的网站构建推荐引擎.该网站由许多页面组成,因此我正在跟踪用户点击的次数,例如,从页面 A 到页面 B.目前我可以测量 A ->B 在 Google Analytics 上使用 previousPagePath = '/A'nextPagePath = '/B' 进行转换,但我真正想回答的问题是Of对网站的所有访问,包括查看页面 A,页面 B、C、... 在同一次访问中查看了多少次?"

I'm trying to gather information from Google Analytics to build a recommendation engine for my site. The site consists of many pages, so I'm tracking the number of times a user clicks, for example, from page A to page B. Currently I can measure the A -> B transitions on Google Analytics with previousPagePath = '/A' and nextPagePath = '/B', but the question I really want to answer is, "Of all the visits to the site that included viewing page A, how many times were pages B, C, ... viewed in the same visit?"

例如,如果流程是 A ->主页 ->B,那么这不会被我当前的方法所捕获,但会被更广泛的度量所捕获.看起来 Google Analytics 网络界面上的访问者流"报告包含我要查找的数据,但我不知道如何通过 API 以编程方式访问它.

For example, if the flow was A -> homepage -> B, then that would not be captured by my current methodology, but would be captured by the broader measure. It looks like the "Visitors Flow" report on the Google Analytics web interface has the data I'm looking for, but I can't figure out how to access it programmatically via the API.

获取这些数据的最佳方式是什么?

What is the best way to get this data?

推荐答案

这真是个好主意.我对此有点晚了,但是您应该能够通过使用 Google Analytics Reporting API 下载所有数据,将其存储在本地数据库/文件/任何内容中,然后通过聚合手工统计并将其存储在本地.

This is a really great idea. I'm a little late to this, but you should be able to accomplish this by downloading all of the data using the Google Analytics Reporting API, store it in a local database/file/whatever, and then build your recommendation engine by aggregating the statistics by hand and storing them locally.

要从 Reporting API 获取数据,请尝试使用 query explorer 并提取数量使用类似于@carlsoja 的方法访问所有路径对之间的页面:

To get the data from the Reporting API, try playing with the query explorer and extracting the number of visits to pages between all pairs of paths using a method similar to @carlsoja:

dimensions=ga:previousPagePath,ga:pagePath&metrics=ga:visits

为了获得所有数据,您必须使用核心报告之一客户端库对结果进行分页(您可以在查询浏览器).

In order to get all of the data, you will have to use one of the Core Reporting Client Libraries to paginate through the results (which you can experiment with in the query explorer).

获得所有数据后,您可以非常轻松地计算一个人访问页面的马尔可夫链转换概率/A 在他们访问了页面 /Bp(/A |/B) 之后.如果某人在过去的某个时间点访问了页面 /B,那么估计他们访问页面 /A 的概率将非常简单.如果你真的想变得很花哨,你可以使用他们的完整历史 {H} 通过估计 p(/A | {H}) 来为页面推荐,但我将其作为练习留给读者;)

Once you have all of the data, you can pretty easily calculate the Markov Chain transition probabilities that a person visits page /A after they have visited page /B, or p(/A | /B). Then it would be pretty straightforward to estimate the probability that someone visits page /A if they visited page /B at some point in the past. If you wanted to get really fancy, you could use their complete history {H} to make recommendations for pages by estimating p(/A | {H}), but I'll leave that as an exercise for the reader ;)

希望这有帮助!

这篇关于获取 Google Analytics“访问者流量"来自 API 的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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