How can I identify the end of a customer session?

I’m a developer. I’m not sure if there is a sign of the ending of the session when the customer visits the storefront.

you can detect the end of a session on a storefront by using cookies and tracking the user’s activity on the website.

Session Timeout

Inactivity Timeout

Page Unload

Cookies