How to monitor when a tab is closed in freshdesk?

Hi everyone,

Greetings!

Is there a way to detect when a ticket tab (browser tab) is either moved out of focus or closed?

I noticed that the Average Handling Time feature handles this quite seamlessly.
Does anyone know how to achieve similar functionality that works consistently across all browsers?

Thanks in advance!