Clarity session recording fails to start on SPA navigation
0 reputation · 11 May 2026, 00:12 UTC
When integrating Microsoft Clarity into a single‑page application, the goal is to capture a continuous user session across route changes without interruption. The Clarity JavaScript snippet is inserted once in the document head, and the project tracking ID is the only required identifier. However, the documentation does not explicitly state how Clarity detects navigation events in an SPA; this omission creates uncertainty about whether a new session is automatically started or whether the existing session continues.
The current behavior observed in some projects suggests that the session may reset on each route transition, implying that Clarity might rely on a full page reload or a specific navigation event that is not triggered by client‑side routing. If this is indeed the case, the performance impact and data fragmentation could be significant for analytics.
To clarify the integration, the following questions need to be answered:
- What event or condition does Clarity use to determine the start of a new session in a single‑page application?
- Does Clarity provide a public API or configuration option to manually trigger session continuation or restart during client‑side navigation?
- In the absence of a dedicated event, what best‑practice pattern is recommended to maintain session continuity across SPA route changes?