Enhanced tracking & visualization for your Streamlit apps.
streamlit-analytics2
is a fork and extension of the original streamlit-analytics, aimed at improving and securing the analytics functionality within Streamlit applications. With minimal setup, track user interactions and visualize analytics directly in your browser, akin to Google Analytics but tailored for Streamlit.
This fork was initiated due to the inability to collaborate directly on the upstream project, which currently has several unresolved security issues and bugs. Our intention is to maintain a positive relationship with the original project and its creator, focusing on enhancing the tool's reliability and security for the community.
[!Note] This fork is confirmed to fix the deprecation
st.experimental_get_query_params
alerts. Context
It also resolved 25 security issues that exist in the upstream (2 Critical, 11 High, 10 Moderate, 2 Low)
This project is in active development. We welcome contributions and address security concerns on a best-effort basis, with details available in our CONTRIBUTING.md and SECURITY.md respectively.
pip install streamlit-analytics2
Only two single characters need to be changed and this has been tested and verified to work.
[!IMPORTANT] This project aims to be backwards compatible with the upstream and migration literally just means adding the number 2 and getting the new package.
The above steps should be sufficient but if you need more steps, check out our Migration Guide.
Simple integration with any Streamlit app:
import streamlit as st
import streamlit_analytics2 as streamlit_analytics
with streamlit_analytics.track():
st.write("Hello, World!")
st.button("Click me")
All interactions are now tracked, supporting all standard Streamlit widgets.
Another way to get the tracking is to call the streamlit_analytics.track() on your main() function:
import streamlit as st
import streamlit_analytics2 as streamlit_analytics
with streamlit_analytics.track():
main()
def main():
st.write("Hello, World!")
st.button("Click me")
Using streamlit_analytics.track() is the recommended method and will become the primary way to initiate streamlit-analytics2 after the upcoming v.1.0.0 release.
Your contributions are welcome! Please refer to our CONTRIBUTING.md for guidelines on how to make a difference. The step by step guide will show you how to set up a dev environment, testing standards and how to make a PR.
We prioritize the security of our users' data. For reporting security vulnerabilities or for more information, please review our SECURITY.md.
A special thanks to jrieke and all contributors to the original streamlit-analytics
project. Your work has inspired continued innovation and community collaboration.