Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Time Spent by user on a web page + Iframe

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.

.

  1. Is there a way to handle this case or any other library which handles this case?
  2. Actually, these libraries fail to calculate the time spent by the user inside an iFrame.What is the best way to know when a user is active in an IFrame?
  3. How does Google/AppNexus/Motomo calculate interaction time? Is there a common design/architecture that they follow?

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

like image 327
Deepak Kumar Avatar asked May 07 '19 12:05

Deepak Kumar


People also ask

How does the'time spent on a page'work?

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.

How to see time spent by a user on a webpage?

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?

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.

What is the difference between average time on page and session duration?

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.


1 Answers

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

like image 59
Deepak Dixit Avatar answered Sep 30 '22 17:09

Deepak Dixit