3 ms·
What use-cases are there for this feature other than tracking users? Anyway, the best solution is to pass any links through a redirect which is responsible for
by TheAceOfHearts 5y ago
What use-cases are there for this feature other than tracking users?
Anyway, the best solution is to pass any links through a redirect which is responsible for logging the visit. That's how Google tracks what search results get clicked on. And it doesn't require any JavaScript.
I'm surprised they didn't even mention it as a possibility.
- capableweb 5y ago> What use-cases are there for this feature other than tracking users? Social services where users want to signal if they are online/offline Users who want to know how much time they've spent on a platform. Closing down sessions for things that can be expensive to just run "forever". Think VMs and similar that gets started when the user visits the page, that you want to turn off when they leave. The use cases are many, and there are also many other alternative solutions, this is obviously not the only one. But as always, all of them come with their own tradeoffs, so this technique might be the best for some of them.
- adhesive_wombat 5y agoYou will already need to handle the case when you don't get the last request, because there are more ways the user can just vanish on you: suspending the computer, killing the browser process, crashing the browser, turning off WiFi or going out of range, etc, etc. The best you can hope for is a "happy path" where you can clear up a little sooner in most cases, but you can't rely on it. If a user being on a webpage is holding open a resource, that might be an architectural issue.
- dspillett 5y ago> might be an architectural issue That definitely is an architectural issue. Unfortunately it is essentially a cache management matter (cache invalidation considers when something becomes useless/wasteful, as well as when it becomes incorrect) which is a hard problem to solve. There are legitimate circumstances where a user causes a long running prices to start, that it is wasteful to continue if incomplete when they vanish (because the result isn't going to be useful to another user, or even that same user if they return). While you can't catch everything (the user's machine losing power or all connectivity, etc.) you can catch a deliberate exit. And in the case of a long running process, if the user's exit was accidental it is more likely that they'll be back and having continued the process is useful.
- dspillett 5y agoLet us not forget that tracking users is not a single use case. Closing off cached resources when a user vanishes is a good thing, it saves resources for other users and could, if I may stretch a little, have environmental impact. Noting that sessions tend to end after a particular set of circumstances could mean spoting something in your application that is annoying people, something that particularly in an SPA you might otherwise not easily detect. Sometimes tracking is legitimately benign. It is only when unnecessary PII is included, and kept to track each specific user over time rather than just over a session, that it gets stalky to the point of begin in my "I won't do that" list (sharing the PII around further gets you on my "you are morally wrong for doing that" list). > surprised they didn't even mention it as a possibility The article is focused on detecting when a user leaves. While a fair amount if that will be detectable because they've clicked a link, it doesn't cover the large case set that is closing tabs and windows. Something I might have to investigate (or search to see if someone else has): do any of these techniques work reliably on controlled OS shutdown.
- daveoc64 5y agoSome systems lock records while users are viewing them, so it can be helpful to send a request that unlocks the record when the user leaves the page.
- XCSme 5y agoDoing resource-locking client-side authoritative sounds like a security issue.
- maccard 5y agoWhat if they just close their laptop lid, or the browser crashes? You can't reliably detect when a user leaves with this method, so you _cant_ use it for anything critical
- unilynx 5y agosure you can, if you combine it with a timeout and/or a way for users to break a lock (and then of course, blocking the original user's session if he comes back anyway) at least you don't have to wait for the timeout to expire if the user properly closed the application/website, which happens most of the time
- gwern 5y ago"Tracking users" has lots of uses. For example, we were trying to do OP on gwern.net for a while, using several of those tricks. It failed miserably and we could never figure out why. What evil things were we doing? Well, I wanted to know if people were using the links I put inside popups, like to Google Scholar. Was anyone using them? If not, they were just so much clutter and should be removed for the users' benefit. I also wanted to get a list of outbound links by popularity, so I could write summaries/annotations for the most popular unannotated links, and rank dead links by priority for fixing (there are too many unannotated or dead links to 'just fix', so a ranking would've helped a lot). But the link tracking never worked, so, I couldn't do any of that.