Skip to content
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

Send/create $session_id on $snapshot events #96

Merged
merged 3 commits into from Oct 21, 2020
Merged

Conversation

macobo
Copy link
Contributor

@macobo macobo commented Oct 20, 2020

Semantics of session id:

  • 30 minutes without an event = new session (same as main repo session calculations)
  • Two tabs will share the same session id
  • Incognito/not incognito/different browser will not share session_id

These may change long-term.

Checklist

  • Tests for new code (if applicable)
  • TypeScript definitions (module.d.ts) updated and in sync with library exports (if applicable)

This will be used by the BE to aggregate recordings

nanoid package used adds ~1kb to the bundle.

(Current) semantics of session id:
- Two tabs will share the same session id
- Incognito/not incognito/different browser will not share session_id

This is to be improved later
Turns out it was sort of already rolled into this package
@timgl
Copy link
Collaborator

timgl commented Oct 21, 2020

Is there any reason we shouldn't be doing this for all events?

@macobo
Copy link
Contributor Author

macobo commented Oct 21, 2020

Is there any reason we shouldn't be doing this for all events?

I don't think we have a usecase for it right now.

We can't use $session_id (directly) in sessions view for grouping sessions because current solution (awesomely) groups events from different posthog libraries, including server-side ones which would not have access to $session_id.

It makes much more sense for session replay since you don't want two sessions in different browsers be interlinked. I'll also be making use of $session_id when deleting old snapshots/storing them in S3.

Note long-term we probably can make $session_id tab-dependent as well, so it would capture two recordings instead of one.

@timgl
Copy link
Collaborator

timgl commented Oct 21, 2020

Ah yep, that makes sense to me. 🚢

@macobo macobo merged commit 55d1b31 into master Oct 21, 2020
@macobo macobo deleted the session-id-generation branch October 21, 2020 08:12
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.

None yet

2 participants