Connecting streamlit app to a database in order to save users actions

Hey all, I am pretty new to coding.

I am trying to build a web app using streamlit.
I want to create profile accounts for every user that i have, and to be able to save his actions and to create a continues in the usage.

What is the best way to do it? how can i connect my streamlit app to a database? can i also add tracking tools like google analytics?

Thank you very much for the helpers!!

There is a guide that may help how to solve your issue.