堆分析-如何捕获用户在页面上花费的时间? [英] Heap Analytics - How do I capture the amount of time users spend on a page?
问题描述
我正在使用Heap Analytics来跟踪事件(页面点击和页面浏览),但是一旦注册事件,我就很难找到如何衡量用户浏览页面多长时间了.
I am using Heap Analytics to track events (page clicks and page views), but once registering the event I am having difficulty in finding how to measure how long user views a page.
与该度量唯一相似的地方是在图表中,在平均时间间隔内,对于我选择页面浏览的页面以及开始和结束事件而言.
The only place similar to this measurement is in the graphs, under average time between, for pages where I select page view, along with a start and end event.
如果这是跟踪页面浏览事件的方法,那么开始是什么,结束事件是什么?
If this is the method to track event for page view, what is the start, and what is the end event?
推荐答案
更新25NOV16:在使用类似方法一段时间后跟踪用户出口(因此,整个会话时间)之后,我可以说以下方法有效,但不是100%的时间.我不清楚决定成功的因素(可能是等待时间).
UPDATE 25NOV16: After using a similar method for a little while to track user exits (and thus, total session time), I can say that the below method works, but not 100% of the time. It's unclear to me what determines the success (latency, maybe).
在我发表评论(我删除了评论)之后,我做了一些测试,并找到了解决方案,但是它需要一个自定义事件,因此您无法进行任何追溯分析.
after my comment (which i deleted) i did a little testing and i have a solution, but it requires a custom event, so you can't do any retroactive analysis.
首先,为任何页面定义一个 page_view
事件.
First, define a page_view
event for whichever page.
然后,在您的页面中,添加以下代码段:
Then, in your page, add this snippet:
window.onbeforeunload = function() {
heap.track('pageExited', {arbitraryProp: "string"})
}
然后,在堆仪表板的图形视图中,可以选择平均时间
, page_view
和 pageExited
.
Then, in the graph view of the heap dashboard, you can select average time between
, page_view
, and pageExited
.
请注意,除用户退出页面外, onbeforeunload
还会在用户刷新时触发.
Note that onbeforeunload
will fire when user refreshes, in addition to when user exits page.
这篇关于堆分析-如何捕获用户在页面上花费的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!