All Projects β†’ jrieke β†’ streamlit-analytics

jrieke / streamlit-analytics

Licence: MIT license
πŸ‘€ Track & visualize user interactions with your streamlit app

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to streamlit-analytics

analytics
A Flarum extension that provides your forum piwik's and google's analytics features
Stars: ✭ 32 (-65.22%)
Mutual labels:  google-analytics
Text-Summarization
Abstractive and Extractive Text summarization using Transformers.
Stars: ✭ 38 (-58.7%)
Mutual labels:  streamlit
leafmap
A Python package for interactive mapping and geospatial analysis with minimal coding in a Jupyter environment
Stars: ✭ 1,299 (+1311.96%)
Mutual labels:  streamlit
map-floodwater-satellite-imagery
This repository focuses on training semantic segmentation models to predict the presence of floodwater for disaster prevention. Models were trained using SageMaker and Colab.
Stars: ✭ 21 (-77.17%)
Mutual labels:  streamlit
mune
Simple stock price analytics
Stars: ✭ 14 (-84.78%)
Mutual labels:  streamlit
streamlit-aggrid
Implementation of Ag-Grid component for Streamlit
Stars: ✭ 465 (+405.43%)
Mutual labels:  streamlit
streamlit-d3-demo
D3 in React in Streamlit tech demo
Stars: ✭ 50 (-45.65%)
Mutual labels:  streamlit
thvu-blog
My digital home on the internet.
Stars: ✭ 51 (-44.57%)
Mutual labels:  google-analytics
Nebula
Nebula is a WordPress theme framework that focuses on enhancing development. The core features of Nebula make it a powerful tool for designing, developing, and analyzing WordPress websites consistently, yet its deliberately uncomplicated code syntax also serves as a learning resource for programmers themselves.
Stars: ✭ 120 (+30.43%)
Mutual labels:  google-analytics
farolcovid
🚦πŸ₯. Ferramenta de monitoramento do risco de colapso no sistema de saΓΊde em municΓ­pios brasileiros com a Covid-19 β€’ Monitoring tool & simulation of the risk of collapse in Brazilian municipalities' health system due to Covid-19
Stars: ✭ 49 (-46.74%)
Mutual labels:  streamlit
deepstack-ui
UI for working with Deepstack
Stars: ✭ 115 (+25%)
Mutual labels:  streamlit
streamlit-ace
Ace editor component for Streamlit.
Stars: ✭ 130 (+41.3%)
Mutual labels:  streamlit
Streamlit-Applications
Deep Learning and Computer Vision Applications using Streamlit
Stars: ✭ 55 (-40.22%)
Mutual labels:  streamlit
universal-ga
Universal Google Analytics module for node
Stars: ✭ 13 (-85.87%)
Mutual labels:  google-analytics
analytics-js-without-segment
A toolset to use Segments open-source analytics library (analytics.js) WITHOUT using the paid Segment service (segment.com). To be used with your favorite analytics-tools like Google Analytics, Mixpanel, Hotjar, etc.
Stars: ✭ 47 (-48.91%)
Mutual labels:  google-analytics
geemap-apps
Interactive web apps created using geemap and streamlit
Stars: ✭ 24 (-73.91%)
Mutual labels:  streamlit
android-aop-analytics
Demo application that implements Google Analytics tracking in an aspect-oriented way using AspectJ.
Stars: ✭ 31 (-66.3%)
Mutual labels:  google-analytics
auto-analytics
UNMAINTAINED! - Complete Google Analytics, Mixpanel, KISSmetrics (and more) integration for JavaScript applications.
Stars: ✭ 28 (-69.57%)
Mutual labels:  google-analytics
favv
Fullstack Web Application Framework With FastAPI + Vite + VueJS. Streamlit for rapid development.
Stars: ✭ 17 (-81.52%)
Mutual labels:  streamlit
cogviewer
Simple Cloud Optimized GeoTIFF viewer.
Stars: ✭ 21 (-77.17%)
Mutual labels:  streamlit

streamlit-analytics  πŸ‘€

PyPi

Track & visualize user interactions with your streamlit app.

This is a small extension for the fantastic streamlit framework. With just one line of code, it counts page views, tracks all widget interactions across users, and visualizes the results directly in your browser. Think Google Analytics but for streamlit.

Alpha version, use with care.


🎈 Live Demo 🎈


Installation

pip install streamlit-analytics

How to use it

import streamlit as st
import streamlit_analytics

with streamlit_analytics.track():
    st.text_input("Write something")
    st.button("Click me")

That's it! 🎈 All page views and user inputs are now tracked and counted. Of course, you can also use any other streamlit widget in the with block (both from st. and st.sidebar.).

Note: One thing that doesn't work (yet) is tracking widgets created directly from containers, expanders, or columns (e.g. st.beta_expander().button("foo")). Instead, please use a with statement, e.g. with st.beta_expander(): st.button("foo").

To view the results, open your app like normal and append ?analytics=on to the URL (e.g. http://localhost:8501/?analytics=on). The results are then shown directly below your app (see image above).

More options

  • If you don't want a huge with block, you can also do:

    streamlit_analytics.start_tracking()
    # your streamlit code here
    streamlit_analytics.stop_tracking()
  • You can password-protect your analytics results with:

    streamlit_analytics.track(unsafe_password="test123")
    # or pass the same arg to `stop_tracking`

    The app will then ask for this password before showing any results. Do not choose an important password here, it's not encrypted. If you push your code to Github, you should probably store the password in a .env file (which is in .gitignore) and load it via dotenv.

  • If you don't want the results to get reset after restarting streamlit (e.g. during deployment), you can sync them to a Firestore database. Follow this blogpost to set up the database and pass the key file and collection name:

    streamlit_analytics.track(firestore_key_file="firebase-key.json", firestore_collection_name="counts")
    # or pass the same args to `start_tracking` AND `stop_tracking`
  • You can store analytics results as a json file with:

    streamlit_analytics.track(save_to_json="path/to/file.json")
    # or pass the same arg to `stop_tracking`

    And load with:

    streamlit_analytics.track(load_from_json="path/to/file.json")
    # or pass the same arg to `start_tracking`

    (Thanks to @Uranium2 for implementing loading!)

    You can also combine both args to persist data to a json file. Note that this file might get deleted when doing a fresh deploy on a cloud service. Use Firestore instead for persistence, see above. Also note that load_from_json will fail silently if the JSON file does not exist. Writing to JSON may lead to problems with concurrency if many users access the site at the same time.

TODO

PRs are welcome! If you want to work on any of these things, please open an issue to coordinate.

  • Pass all settings args in start_tracking and not in stop_tracking

  • Do not track default values for selectbox, text_input etc. This can probably be done easily if I switch to using on_change.

  • Track unique users -> best way is to use cookies (e.g. with react-cookies) but this probably requires to show a consent form (could also build this in with react-cookie-consent)

  • Enable tracking on widgets created directly from beta_container, beta_expander, beta_columns

  • Make a demo gif for the readme

  • Persist results after re-starting app (e.g. database or file, but where should this be saved/hosted)

  • Find an easier alternative to Firestore for saving the data

  • Track time the user spent in a session and show as "complete time spent on your app"

  • Implement A/B testing, e.g. by choosing one option for a new user randomly, storing it in session object, and then returning the correct bool value for below, and tracking & visualizing stats separately for both options:

    if streamlit_analytics.split_test("option a", 2):
        st.button("Is this button text better?")
    
    if streamlit_analytics.split_test("option b", 2):
        st.button("...or this one?")
  • Enable tracking to Google Analytics, e.g. via custom component with react-ga. Widget interactions could also be tracked via events.

  • Add a button to reset analytics results (see issue #2, this should probably show another prompt for confirmation, similar to if you delete a Github repo)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].