Streamlit app view and statistics

I want to know that after I deploy the apps, is there any way to find out the number of views and interaction that is happening with my app? I would like to see some kind of dashboard accessibility. Let me know if something like this is already there and I am just missing it.


Hey @shyamcody Welcome to the community !

Its not available out of the box but streamlit does use prometheus_client at /metrics endpoint to export some of the metrics. check this answer, Performance monitoring ideas?

You can utilize it using a little bit of code to count views by setting up a Counter collector for unique session_ids. I have added this functionality in my update to the that I use for my streamlit apps.

Just copy the module from this gist,

And import count_sessions and call the function at the top of your script, you will be able to see

TYPE session_count_total counter
session_count_total 5.0

at /metrics endpoint. If you want to add a dashboard then you can look into Grafana, prometheus combination of things.

This piece of code,

import streamlit as st
from state import count_sessions



Will give you this,

Hope it helps ! :slight_smile:

Beside this there’s already an issue opened,

PS. you can add anything you want to collectors then eg. times refreshed, function run summaries etc. :smiley:


Hi @shyamcody, welcome to the Streamlit community!

We are thinking about how to surface this to users, whether that’s via a dashboard in Streamlit sharing, a weekly email or something else. I don’t have a timeframe for that, but it is something we’re actively thinking about!


1 Like

That’d be such a great functionnality! :slight_smile:

hey @ash2shukla I will make sure to check it out. Thanks for such a detailed answer.