Building a product metrics dashboard with Streamlit
A Streamlit dashboard that puts DAU/MAU, churn, retention, LTV, CAC, feature adoption and NPS in one place, with the full code on GitHub.
In this post, I’m excited to share a project I recently completed: a Product Metrics Dashboard built using Streamlit. This dashboard is designed to give a centralised view of crucial metrics like user engagement, retention and customer value, all in one place. It’s the type of tool that can empower any product or growth team to make data-driven decisions and optimise performance.
For anyone interested, I’ve shared the full code on GitHub so you can explore it or even try it out yourself: Product Metrics Dashboard on GitHub.
Project overview
The Product Metrics Dashboard tracks essential metrics, including:
- Daily Active Users (DAU) and Monthly Active Users (MAU): to gauge overall product usage
- Churn rate and retention rate: to understand how often users return or leave
- Customer Lifetime Value (LTV) and Customer Acquisition Cost (CAC): for insights into the financial side of customer relationships
- Feature adoption rate and Net Promoter Score (NPS): to measure how engaged and satisfied users are with the product
Each metric provides a different angle on how users interact with the product, helping us make informed decisions for future improvements.
Key features of the dashboard
- Date range filters for DAU and MAU charts: users can select specific timeframes to analyse trends in user activity over various periods.
- Interactive parameters: adjustable parameters for metrics like churn and retention, giving flexibility to view different customer engagement scenarios.
- Real-time visualisations: using Matplotlib, each metric is displayed with interactive charts, making it easy to spot trends and patterns quickly.
These features make the dashboard more than just a data table; it’s a tool that makes data exploration and decision-making much easier.
Project structure
dashboard_app.py: the main Streamlit app file where the dashboard interface is built.calculations.py: a helper file with all the metric calculation functions (DAU, MAU, churn rate, LTV, etc.).data/: sample data files for testing:login_data.csv(DAU/MAU),churn_data.csv(last active dates),retention_data.csv,purchase_data.csv(LTV),nps_data.csvandfeature_usage.csv.
For anyone setting it up, there’s also a requirements.txt file to install all dependencies quickly.
Step-by-step implementation
- Data handling: using Pandas, I load and process the data from each CSV file, ready for calculating metrics and feeding into the visualisations.
- Metric calculations: each metric is calculated in a function within
calculations.py. For example, DAU counts unique users per day; churn rate is based on user activity over a specific cutoff period; LTV is the average revenue generated per user over their lifetime. - Visualisations: each metric is visualised using Matplotlib charts within Streamlit. With real-time data updates, these visualisations show trends at a glance.
Tools and technologies
- Streamlit: for the interactive dashboard interface. It’s incredibly fast for setting up data-driven apps.
- Matplotlib: for charts like line plots and bar graphs.
- Pandas: for loading, cleaning and manipulating data.
Challenges faced
- Data type compatibility: I initially had issues with date range filtering for DAU and MAU because of type mismatches. The solution was standardising all date columns as
datetime64[ns], which allowed smooth filtering and plotting. - Chart compatibility: Streamlit worked smoothly with Matplotlib, but there were a few learning moments around configuring charts to update interactively. Once I adjusted Matplotlib settings for date-based charts, everything fell into place.
Each challenge made the project more rewarding and taught me a lot about working with data in real-time environments.
Future improvements
- More customisable filters: deeper filters to analyse data by cohort, demographic or region.
- Performance optimisation: handling larger datasets more efficiently, possibly by loading data in chunks or caching intermediate calculations.
- Advanced visualisations: libraries like Plotly for even more interactive charting.
What’s next
After this project, I planned to integrate Facebook’s Lead Gen data with AWS Lambda: a webhook that automatically transfers lead data to an AWS endpoint for processing. I wrote that one up too: Real-time Facebook lead integration.
Closing thoughts
I learnt a lot through this project and I’m excited to keep exploring and building in the data and analytics space. If you’d like to try it, the full code and setup instructions are on GitHub. I’m always open to feedback and questions.
Want to talk about this, or something like it for your team?
Email me