I've been using beforeunload to check my users leaving web pages, and it all works well, the thing is, now I want to run a function only when the user is leaving my website / domain.
So for example, going from mywebsite.com to mywebsite.com/app wouldn't trigger the function, but going from mywebsite.com to google.com would.
I don't care about what website they're going to, I just want to know if they're staying on my domain or not.
I can't get anything on the parameter of the beforeunload function. I've read a bit around the web, but no cigar. Any ideas?