akamai / boomerang

End user oriented web performance testing and beaconing
http://akamai.github.io/boomerang/
Other
1.86k stars 292 forks source link

How to know user spent time on page #345

Open iwindfree opened 1 year ago

iwindfree commented 1 year ago

Hi, I use boomerang script.

I want to know the amount of time a user spends on a page. In boomerang document, " rt.quit: This parameter will exist (but have no value) if the beacon was fired as part of the onbeforeunload event. This is typically used to find out how much time the user spent on the page before leaving "

For page unload beacon(rt.quit exist) , what value I used to find out how long user stayed in page. I kept checking the source, but I couldn't find out exactly, so I'm asking.

bluesmoon commented 1 year ago

Use the t_done value from that beacon

iwindfree commented 1 year ago

Thanks for your reply. but is t_done is page elapsed time? In my test, for example. I entered the page1. ( 10:00:00) I leaved the page1. (10:00:30) // after 30 seconds When I leaved the page1, I received page unload beacon (rt.quit exist). but in page unload beacon, t_done value is 270ms. I think that it may not the time user stayed in that page.

I think that I could find the time which user stayed a page with the same session and the same page id in the history data and compare the values. However, it can take a lot of time in a lot of data, so I asked if we could know the corresponding value from the unload beacon. (above example, 30 sec)

Thanks in advance.

bluesmoon commented 1 year ago

May be a bug in t_done then. In any case, you can look at rt.end and subtract either rt.tstart or nt_load_end depending on whether you want it from navigation start or load complete.

iwindfree commented 1 year ago

Thanks for your reply.

But unload beacon (rt.quit exist), rt.end - rt.start not represent page stay time. It only equal to t_done. I think that I search the first beacon and unload beacon for same page id, and rt.end of unload beacon and substract rt.tstart or nt_load_end of first beacon.

bluesmoon commented 1 year ago

Unless you have a SPA, nt_load_end and rt.tstart are always the timestamp of the navigation start of the page. They will be the same for all beacons on the same navigation. For single page apps there are multiple navigations in a single page, so maybe that is what you're seeing.

iwindfree commented 1 year ago

Thnaks for your reply. I build boomerang script with spa plugin support SPA based web page and normal web page. In my test web page is not SPA type. but boomerang is buid with spa plugin, the problem happened. I try to another way to check page stayed time. thank you.