Skip to content

feat: Add page_name field to UserEvent model for all log events#23

Merged
anantdamle merged 1 commit intomainfrom
fix_18
Feb 5, 2026
Merged

feat: Add page_name field to UserEvent model for all log events#23
anantdamle merged 1 commit intomainfrom
fix_18

Conversation

@anantdamle
Copy link
Collaborator

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

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
@anantdamle anantdamle merged commit cfb66a5 into main Feb 5, 2026
5 checks passed
@anantdamle anantdamle deleted the fix_18 branch February 5, 2026 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add page name to all logs

1 participant