Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do google analytics detect the user leaves page?

This is the context of a single-page application, but I believe it would happen as well in other cases. While the GA tracker get's updated with page changes I can see in the realtime report that the user is still alive. But when the user doesn't interact with the page for a while (while playing a video for example) it disconnects from the GA view.

I would like to better understand how GA works in this case, maybe I need send events to keep the user alive.

like image 972
a--m Avatar asked Dec 19 '14 21:12

a--m


People also ask

Does Google Analytics track the time when user closes the page?

GA doesn't account for the time spent on the last page of a user's session—no matter how long they were there. This means that exit and bounce pages are excluded from the average session duration metric because by default, an exit page's time on page is always '0'.

Can Analytics tell you where your customers go after leaving your website?

Google Analytics can give you insight into where people are leaving your website, and you can then do a bit of detective work to try and work out why that might be. Here's three metrics to look at.

How does Google Analytics track a user?

Google Analytics acquires user data from each website visitor through the use of page tags. A JavaScript page tag is inserted into the code of each page. This tag runs in the web browser of each visitor, collecting data and sending it to one of Google's data collection servers.

Is the of users in Google Analytics who leave from the landing page?

The bounce rate is the percentage of visitors who leave your landing page without venturing further into your site.


1 Answers

Google Analytics does not detect when somebody leaves the page. There is no reliable way to do that (unload handlers do not fire when somebody just closes the window). Instead Google waits till the session has ended - after 30 minutes without interaction (can be adjusted in Universal Analytics in the property settings) the session is ended and the vsitor has left as far as the reports are concerned (he might have left a lot earlier, but the time after the last interaction is not tracked in GA).

Plus a session can have 500 interactions at maximum, so there is no way to keep it alive indefinitely.

like image 100
Eike Pierstorff Avatar answered Oct 27 '22 13:10

Eike Pierstorff