Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to know user spent time on page #345

Open
iwindfree opened this issue Feb 26, 2023 · 6 comments
Open

How to know user spent time on page #345

iwindfree opened this issue Feb 26, 2023 · 6 comments

Comments

@iwindfree
Copy link

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
Copy link
Member

Use the t_done value from that beacon

@iwindfree
Copy link
Author

iwindfree commented Feb 27, 2023

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
Copy link
Member

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
Copy link
Author

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
Copy link
Member

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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants