AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
1.9K members online now
1.9K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Track end user time on page with events

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I would like to track the time a user spends on a given page on our site, down to the minute if possible. I know that GA limits the number of events per session that can be sent (I believe it's 500 events/session) - which should be sufficient, as the page in question is for a live audio broadcast which should not be longer than 90 minutes.

 

My only thought is to use:

setTimeout()

with a GA event call inside, perhaps at 5 minute intervals, but this would involve at least 18 "setTimeout()" calls on the page.

 

Has anyone implemented this concept using Google Analytics? Is there a better way to track this using a different method?

1 Expert replyverified_user

Track end user time on page with events

Top Contributor
# 2
Top Contributor

Hi @Chris W - you could opt to use beforeunload event https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload which would send an event only once per page. 

 

There are of course other solution which track non idle time such as https://www.simoahava.com/analytics/track-content-engagement-part-2/.

 

In any case the 500 session hit limit is an issue.

 

If in any way possible try to use the media tool API if applicable to use time based events for percentage viewed? Each couple of minutes?

 

Kind regards,

Zorin

Web analyst @ escapestudio.net