Is it possible to capture the date and time that the user leaves the page (or closes the browser)?

Hi. I have a page where the user inserts his name and e-mail in a database (registration). Wix automatically captures the registration date and time. Is it possible to also capture the date and time that the user leaves the page (or closes the browser)?

This little code-snippet could help you out…

import wixUsers from 'wix-users';

let user = wixUsers.currentUser; console.log(user)
let userID = user.id; console.log(userID)
let isLoggedIn = user.loggedIn; console.log(isLoggedIn)