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?
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.
First, define a page_view
event for whichever page.
Then, in your page, add this snippet:
window.onbeforeunload = function() {
heap.track('pageExited', {arbitraryProp: "string"})
}
Then, in the graph view of the heap dashboard, you can select average time between
, page_view
, and pageExited
.
Note that onbeforeunload
will fire when user refreshes, in addition to when user exits page.