I want to measure the time spent by a user on web pages. It's doesn't include the time when a user navigates away from the browser.
I found few open source libraries like Timejs library which can measure the time spent by a user on a web page, but when a user is watching a Youtube video on the page, these libraries don't measure that time.
.
PS: I am trying to integrate the library with my react App. If there exists any similar method to solve this problem in React. Please let me know in comments/answers.
Thanks in advance
It compares the previous request time against the new request time, and calls that the 'time spent on your web page'. It doesn't actually know if someone is viewing your page, has minimized the browser, has switched tabs to 3 different web pages since last loading your page, etc.
9) Open a browser & point to http://localhost, It will show you "UID" & time spent by you on the webpage. 10) Now, Close the browser tab & point to http://localhost/dashboard 11) Here you can see the list of all the users with their corresponding time spent on the page.
Can iframes affect the loading speed of my website? Every iframe on a page will increase the memory used as well as other computing resources like your bandwidth. So, you should not use iframe excessively without monitoring what’s going on, or you might end up harming your page performance.
Average Time on Page measures the average duration of time spent on a specific web page or group of web pages on your website, whereas Average Session Duration measures the average duration of all sessions on your website, which can consist of multiple web pages.
HTML5 Page Visibility API is the answer of your question.
You need to just listen an event as per the browser and it will be triggered every time when user will jump to another tab.
Look to Page Visibility API
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With