News for hackers. Stuff that matters.
Re:Google Analytics: Stop feeding the beast by bashinator on Thursday February 25, 2021 @03:01PM (#26267500)
Serious question - does Google Analytics tell you if I abruptly close your page only a few seconds after it's started loading?
Re:Google Analytics: Stop feeding the beast by lmkg on Thursday February 25, 2021 @03:26PM (#26267816)
Out-of-the-box, no. With custom work, yes. The amount of effort is not large, and there are off-the-shelf solutions available. The name commonly used is "engagement timer."

By default, GA only sends one hit on page load. If there's no second hit, there's no way to tell if someone was looking at the page for a second or a minute or an hour.

Re:Google Analytics: Stop feeding the beast by hnick on Thursday February 25, 2021 @10:15PM (#26271034)
How do they handle it? A keep-alive style ping, or something like a beforeunload event hook?
Re:Google Analytics: Stop feeding the beast by e_y_ on Friday February 26, 2021 @12:34AM (#26271670)
In theory the correct way to send analytics when leaving the page is via navigator.sendBeacon, although it's not clear how reliable it is: https://volument.com/blog/sendbeacon-is-broken (note: read the comments for some rebuttals to the article)
Re:Google Analytics: Stop feeding the beast by nxpnsv on Thursday February 25, 2021 @03:10PM (#26267615)
You get an idea how long someone has the page open yes.
Re:Google Analytics: Stop feeding the beast by bogus-official on Thursday February 25, 2021 @03:48PM (#26268096)
But only if the user goes on to visit another page. You don't see how much time they spent on last page they visited, even if they only visit one page, by default.
Re:Google Analytics: Stop feeding the beast by aww_dang on Friday February 26, 2021 @12:35AM (#26271672)
Depends on the events you are tracking.