feat: Add page_name field to UserEvent model for all log events#23
Merged
anantdamle merged 1 commit intomainfrom Feb 5, 2026
Merged
feat: Add page_name field to UserEvent model for all log events#23anantdamle merged 1 commit intomainfrom
anantdamle merged 1 commit intomainfrom
Conversation
Previously, the page_name was only included in the `extra` field of START_TRACKING events. This change promotes page_name to a first-class field in the UserEvent model, ensuring it is included in all log events (widget interactions, start_tracking, etc.). Changes: - Add `page_name` attribute to UserEvent dataclass - Add `with_page_name()` method for fluent API pattern - Update `to_dict()` to include page_name in serialized output - Store page_name in StreamlitPageAnalytics instance and enrich all events with it via `log_event()` - Update tests to verify page_name appears at top level instead of in extra field This enables downstream consumers to filter and analyze logs by page without needing to parse the extra field. Fixes #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, the page_name was only included in the
extrafield of START_TRACKING events. This change promotes page_name to a first-class field in the UserEvent model, ensuring it is included in all log events (widget interactions, start_tracking, etc.).Changes:
page_nameattribute to UserEvent dataclasswith_page_name()method for fluent API patternto_dict()to include page_name in serialized outputlog_event()This enables downstream consumers to filter and analyze logs by page without needing to parse the extra field.
Fixes #18