analytics: use anonymous users#1211
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR ensures analytics events and session replays are always associated with a user by auto-creating anonymous users when no authenticated session exists. The shared Additionally, a switch/case bug in
Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Tick as _tick() (every 5-10s)
participant GAT as getAnalyticsAccessToken
participant Session as Session Store
participant API as Backend API
Tick->>GAT: getAccessToken()
GAT->>Session: getOrFetchLikelyValidTokens()
alt Token exists (user logged in)
Session-->>GAT: accessToken
GAT-->>Tick: token
Tick->>API: flush events with token
else No token
GAT->>GAT: _hasPersistentTokenStore()?
alt Has token store
GAT->>API: _signUpAnonymously()
API-->>GAT: anonymous user tokens
GAT->>Session: getOrFetchLikelyValidTokens()
Session-->>GAT: new accessToken
GAT-->>Tick: anonymous token
Tick->>API: flush events with anonymous token
else No token store
GAT-->>Tick: null
Note over Tick: Events buffered indefinitely (no cap)
end
end
Last reviewed commit: e545adc |
packages/template/src/lib/stack-app/apps/implementations/event-tracker.ts
Show resolved
Hide resolved
packages/template/src/lib/stack-app/apps/implementations/session-replay.ts
Show resolved
Hide resolved
Additional Comments (1)
The removed pre-auth buffer cap ( |
No description provided.