Skip to content

Use session-stored UUID7 for anonymous ID - #27

Merged
jszobody merged 2 commits into
masterfrom
anonymous-id-session-uuid
Feb 20, 2026
Merged

Use session-stored UUID7 for anonymous ID#27
jszobody merged 2 commits into
masterfrom
anonymous-id-session-uuid

Conversation

@jszobody

Copy link
Copy Markdown
Member

Summary

  • getAnonymousId() now stores a UUID7 in the session via session()->remember(), giving anonymous users a stable ID across requests (and surviving session regeneration)
  • Falls back to a static UUID7 for non-session contexts (CLI, queue workers) where cross-request bleed isn't a concern
  • Session hash moved from getUserId() into getAnonymousId() — session-based users are anonymous (not authenticated)
  • Bumps minimum to Laravel 11 / PHP 8.2 for Str::uuid7() support
  • Updates README docs

Test plan

  • All 77 existing tests pass
  • Verify anonymous ID is stable within a session across multiple metrics
  • Verify Octane safety: each request gets its own session, so no ID bleed

Replace hashed session ID with a UUID7 stored via session()->remember()
so anonymous users get a stable ID across requests and session
regeneration. Fall back to a static UUID7 for non-session contexts.
Bump minimum to Laravel 11 / PHP 8.2 for Str::uuid7() support.
@jszobody
jszobody merged commit 7390f31 into master Feb 20, 2026
1 check passed
@jszobody
jszobody deleted the anonymous-id-session-uuid branch February 20, 2026 17:55
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.

1 participant