444B / streamlit-analytics2

👀 Track & visualize user interactions with your streamlit app
MIT License
14 stars 2 forks source link

Tracking buttons with the same name #26

Open 444B opened 4 months ago

444B commented 4 months ago

Original issue by amirmk89 on 2023-01-12 15:10:09+00:00

Hi, awesome tool!

I have a use case where several buttons have the same text, and currently the analytics tool tracks all of them as a single button. Each of the buttons has a unique key, and I thought it could be useful to support key based indexing instead of, e.g., button label based. Is this possible in streamlit-analytics?

Thanks!

444B commented 4 months ago

Comment by nathanjones4323 on 2023-03-21 15:53:51+00:00

Same here

I believe the issue happens during the "monkey patching" of the widgets inside main.py Here & Here & Here

The widget state/key gets set by default to the label of the widget during the "monkey patching", so even if you have a key set for the widget inside of your app, the state_dict used to track widget interaction will use the label of the widget.

Maybe you could move the "monkey patching" inside of your app page, but that seems messy. Ideally, we have the "monkey patched" widgets inside main.py inherit the key from the app file.

444B commented 4 months ago

@amirmk89 @nathanjones4323 is this still relevant?