I have been playing around with the unload functions in Javascript, and whilst these work how I want, they're not entirely what I'm looking to implement.
How can I check if a user on my site is just browsing to another page, or if they are closing the tab/window/leaving the page entirely? I want to only trigger an event when they leave the site.