I was able to figure out when a user launches my app by creating SessionState object. But how can I know if that user closes the webpage and ends the session?
Hi @swswsw, welcome to the Streamlit community!
This is an open question for the digital analytics community, and in the 10 years or so Iโve paid attention to that industry, there really isnโt a good question. The issue is that itโs difficult to tell the difference between someone not doing something on a page vs. they left the page.
You can try to implement some fancy javascript to either ping a โheartbeatโ back to a listener of some sort, or you can try and intercept the back button or link clicking, but in the end thatโs a pretty aggressive tactic towards your users.
What is your use case? Maybe thereโs an easier way to achieve what you are looking for.