-
Notifications
You must be signed in to change notification settings - Fork 53
chore: ensure session_id context works with page method #269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: ensure session_id context works with page method #269
Conversation
| self.assertEqual(msg["uuid"], "new-uuid") | ||
| self.assertEqual(msg["distinct_id"], "distinct_id") | ||
|
|
||
| @parameterized.expand( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those were for finding my way around the SDK, but I think they're fine to keep. I can remove them otherwise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Added support for session ID preservation in the PostHog Python client's page() function to maintain consistent session tracking between frontend and backend events.
- Added session ID handling in
page()function to match behavior ofidentify()andcapture()methods - Modified context handling to ensure automatic inclusion of session IDs when available in global context
- Added comprehensive test suite covering session ID persistence across different event capture scenarios
- Improved cross-platform session tracking by standardizing session ID handling between frontend and backend events
2 files reviewed, no comments
Edit PR Review Bot Settings | Greptile
rafaeelaudibert
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes a lot of sense to me, LGTM :)
I am investigating some tickets (e.g, https://posthoghelp.zendesk.com/agent/tickets/32213) that send events on both frontend and backend, and wish to keep the sessionId in sync.
The changes here build upon #264 (thanks @oliverb123, great work!) to ensure we can also keep the session_id in context for the
pageutility function, as well as some redundant tests to verify that we're passing it on to other methods.