>Sometimes we want to send a piece of data to our servers when user leaves our website or webapp.
I've never.
>Maybe it’s for for analytics or even auto-logout when they leave the website.
Just don't persist the auth token? Analytics is blocked at the DNS level anyway.