jasonzissman / TimeMe.js

A JavaScript library to accurately time how long a user views a web page, disregarding idle time and time when the tab or window is minimized.
MIT License
592 stars 124 forks source link

Not working correctly when user watches a video on a page #41

Open nerra0pos opened 7 years ago

nerra0pos commented 7 years ago

When a user is watching a video e.g. YouTube embedded on the page, he fastly goes idle with your script (not accounting the view time of a video).

It would be good, if you could implement a beacon function which could be triggered manually in order to let the script continue measuring time.

glappen commented 6 years ago

TimeMe.resetIdleCountdown() seems to do what you are asking...

javatechy commented 5 years ago

Any working solution ? @terrapop How did you solve this problem?

DanielMalmgren commented 5 years ago

I tried this approach, using the following code:

                            iframePlayer.on('timeupdate', function(data){
                                TimeMe.resetIdleCountdown();
                            });

However it doesn't do anything at all, I can see using a console.log that it's really executed (about four times per secnd) but still it doesn't seem to count the time I'm spending in my video player iframe. Any clues?

DanielMalmgren commented 5 years ago

Hi again. Found a PR that completely solved this problem: https://github.com/jasonzissman/TimeMe.js/pull/59

zvictor commented 1 year ago

I have pushed a new solution for this issue and I would love to have your feedback on it: https://github.com/jasonzissman/TimeMe.js/pull/77