From a click to a session replay: what does a frontend recorder actually collect?

May 14, 2025

Suppose a user clicks “Join activity” twice and never sees a confirmation. A click counter tells me there were two interactions. A product event can tell me which activity they concerned. A replay might show that a loading overlay covered the confirmation. A server trace might show that the second request failed. I would ask for a different piece of evidence at each stage.

This distinction was what interested me when I looked into frontend instrumentation in May 2025. I opened Microsoft Clarity's collection code as well as Sentry's React tracing, profiling and replay documentation. I wanted to know what was being sent over the wire that could later look so much like a recording.

Which question deserves a named event?

For a product funnel I would give the example three distinct events. join_clicked describes intent at the button, join_request_sent describes an attempt, and registration_confirmed belongs at the point where registration actually succeeds. A native click listener can collect the first. Only code that knows the outcome can reliably produce the last. Two rapid clicks can correspond to one successful registration, so I would count confirmed registration IDs when measuring completed registrations.

For this example a small payload might contain an event name, a pseudonymous session identifier, a request correlation ID and an elapsed time. That is sufficient to ask whether retries cluster around slow requests. If the objective is the click-to-confirmation interval, capturing the contents of a chat box contributes nothing to the calculation.

How can a player reproduce the mouse moving across a page?

A web replay system can capture an initial representation of the document, identify nodes and record subsequent changes. The player rebuilds the document and applies the changes in time order. A browser can fire mousemove repeatedly as the pointer crosses an element. Its clientX and clientY give the position within the viewport; recording scroll changes as well lets the player place that movement on the page.1 Clarity calls recordings “visual reconstructions by capturing the HTML and user actions.” An open-source recording library, rrweb, documents how snapshots assign identifiers so later events can refer back to individual nodes.23

Think of these as four illustrative records, with times measured from the start of the example:

TimeRecordWhat the player can reconstruct
0 msSnapshot includes button 17 and an empty status region 24The initial page and its target elements
320 msPointer moves, then clicks button 17The path to the button and the interaction
340 msA loading overlay is insertedThe UI the user waited behind
1,140 msThe text in region 24 changesA confirmation exists in the document, even if the overlay still covers it

A heatmap aggregates interactions from many visits and loses the order within this one visit. A replay preserves that order if the required events were captured. It still cannot tell me that a database transaction committed. Conversely, a successful transaction does not tell me whether the user ever saw the confirmation. A correlation ID can connect those two observations.

What if my screen is wider, or the CSS has changed?

When I looked at Clarity, I first wondered whether I could record every interaction with event listeners. Then I tried to imagine playing those actions on my own screen. On a phone the Join button might sit below the description. On my laptop the same button might sit beside it. What would a click at the original coordinates mean on that layout?

block-beta
  columns 4
  phone["Recorded phone layout"] space wide["If replay used laptop width"]:2
  phoneText["Description"] space wideText["Description"] wideJoin["Join · 17"]
  phoneJoin["×<br/>Join · 17"] space widePoint["×<br/>Empty space"] space
  classDef button fill:#dbeafe,stroke:#2563eb,color:#172554
  classDef empty fill:transparent,stroke:transparent
  class phoneJoin,wideJoin button
  class widePoint empty

The × marks the same offset from the top-left of each viewport. It lands on Join on the phone and on empty space in the wider layout. The recorded target is still button 17.

In the example above, button 17 gives the click a target even if several buttons say “Join.” To show what the visitor saw, the player also needs the document as it looked at that point in time. It can start with a snapshot, replay insertions and attribute changes in order, and draw the pointer using the recorded viewport dimensions and scroll position. When the visitor rotates the phone, the viewport changes again. That is why a recorder needs both changes to the document tree (which a browser can report through MutationObserver) and separate interaction and resize events. I followed Clarity from its collection entry point to the interaction code on the playback side, where it handles a recorded resize.34

How do Rybbit and Clarity keep the phone layout on a laptop?

Suppose the visitor tapped Join in a 390 × 844 CSS-pixel viewport, the area available to the page inside the browser window. The recorder saves those initial dimensions. If the visitor rotates the phone and the viewport becomes 844 × 390, it records a resize. On my 1,440-pixel-wide laptop the replay starts with the narrow layout and switches to the wider layout at the recorded time. A CSS rule such as @media (max-width: 600px) therefore applies before the rotation and stops applying afterward, provided the original stylesheet is available.564

flowchart TD
    V["Initial viewport + later resizes"] --> P["Rebuild the phone layout"]
    R["Rybbit / rrweb"] --> I["Readable CSS saved in the snapshot"]
    C["Clarity"] --> K["Cached stylesheet version"]
    I --> P
    K --> P
    P --> J["Show the recorded tap on Join"]

Read the Rybbit and Clarity branches as alternatives. In this example either player needs enough information to place Join below the description, even on the wider screen.

Rybbit. In v1.4.0, Rybbit used rrweb to record timestamped events and passed them to rrweb-player for playback. The recording contains the visitor’s viewport dimensions and subsequent resize events. The player rebuilds the document in a replay frame using those dimensions. For a linked stylesheet whose rules it can read, the bundled rrweb recorder saves the CSS text in the snapshot. Changing that stylesheet tomorrow will not change those saved rules. If the browser prevents the recorder from reading a sheet’s rules, the snapshot can retain its URL instead. In that case, what the URL serves later can affect the replay.5

Clarity. Its recorder measures width and height on startup and listens for window resizes. The public playback code passes each recorded size to the viewer through its resize callback.6 Microsoft’s later recordings guide explains the CSS side: Clarity caches stylesheets and fonts as playback data arrives and supports selecting the resource version from the time of the recording, even if two deployments used the same URL. A stylesheet behind a login or at an expired temporary URL can still be missing. If yesterday’s overlay loses its positioning rules, the replay might make Join look reachable when it was actually covered.478

Clarity’s player even has an optional check for this kind of discrepancy. It looks up the recorded target node, asks which elements occupy the recorded click coordinates in the reconstruction, and can report a mismatch if the target is absent there. That tells me when to question the picture. It cannot supply the missing CSS or prove what the visitor saw.9

Clarity, Sentry and the frog I remembered

ToolQuestion I would start withA concrete check
Microsoft ClarityWhat did people see and do around this part of the page?Open a recording containing the interaction and compare it with the aggregated click or scroll pattern.
SentryWhat happened in the UI around a reported error or a slow request?Find the relevant error or trace and inspect an associated sampled replay when available. Verify that the request and replay belong to the same interaction.
RybbitCan I examine a product event or session and then look at its replay in the same analytics product?Find a recorded session, inspect its timeline, and play through the click. Check the project's replay setting and masking.

On May 14 I also visited Baidu Analytics and Sensors Data while researching event collection. In Clarity I followed the implementation to the clarity-js entry point. In Sentry I went from capturing errors and messages to distributed tracing, cross-origin propagation, sampling and replay privacy. OpenReplay was another publicly available option at the time. My June 30 history includes Highlight.io. The frog-branded product I remembered seeing later was Rybbit: its v1.4.0 release added session replay on June 30. I cannot date my own first visit to it.10111213

On Android, Sentry’s replay documentation describes a similar debugging question: what did the user tap or swipe just before an error? The replay can show those interactions alongside network requests. The DOM example above explains the web case; Android has its own recording SDK.14

For a later comparison, PostHog illustrates how product analytics and debugging can share one recording. A funnel can show where visitors abandoned registration; opening a recorded session at that step can reveal the overlay that hid the confirmation. Sentry offers another way into a replay, starting from the error or slow request that prompted the investigation.1511

What would make a recording trustworthy?

I would test one session containing a visible button, a masked input, a scroll, a route change and a failed request. First check what actually leaves the browser. Replacing text visually in a player is too late if the original text was already sent to the collector. URLs, custom event fields and any explicitly enabled network capture deserve the same attention as form fields. Then play it back and compare the event order, viewport, target and overlay with what happened on screen. Missing styles can make a replay visually misleading even when the click data is correct.211

Finally I would compare the population behind each number. An error-triggered replay sample is valuable for debugging a broken Join button. Its frequency of failure is a poor estimate of the product-wide rate because the sampling deliberately favored errors. I would use named events and confirmed registrations for that rate, then use the replays to find an explanation for individual cases.

For the same interaction, two companion articles in Chinese cover how page errors and failed HTTP requests reach a collector and how to separate time waiting for Fetch from time executing JavaScript.

References

Footnotes

  1. MDN contributors. (n.d.). Element: mousemove event. MDN Web Docs. Event properties, including clientX and clientY. ↩

  2. Microsoft. (n.d.). Recordings overview, “How are sessions captured?” and Frequently asked questions, “How are recordings collected?” Microsoft Learn. Reconstruction from HTML and actions, collection and rendering details. ↩ ↩2

  3. rrweb contributors. (n.d.). Serialization. GitHub. Snapshots and node IDs. ↩ ↩2

  4. Microsoft. (n.d.). Clarity Visualize: interaction.ts. GitHub. Resize and pointer playback. MDN contributors. (n.d.). MutationObserver. MDN Web Docs. Observing changes to the DOM. ↩ ↩2 ↩3

  5. Rybbit contributors. (2025, June 30). Session replay recorder and player [v1.4.0 source code]. GitHub. Recording rrweb events, passing events to rrweb-player, bundled rrweb serializer and replayer (see inlineStylesheet, _cssText, and ViewportResize). ↩ ↩2

  6. Microsoft. (n.d.). Clarity JS: resize.ts. GitHub. Initial measurement and resize listener. ↩ ↩2

  7. Microsoft. (2025, September 8). Troubleshooting recordings. Microsoft Learn. Missing or outdated styling in recordings. ↩

  8. Microsoft. (n.d.). Frequently asked questions. Microsoft Learn. Why does my website's layout look wrong when rendered in Clarity?. ↩

  9. Microsoft. (n.d.). Clarity Visualize: interaction.ts. GitHub. Pointer placement and optional click mismatch callback. ↩

  10. Microsoft. (n.d.). Clarity JavaScript client. GitHub. Collection entry point. ↩

  11. Sentry. (n.d.). Session Replay for React. Sentry Docs. Sampling and setup, masking and network data. ↩ ↩2 ↩3

  12. Rybbit contributors. (2025, June 30). v1.4.0 [Release]. GitHub. Release notes. Rybbit. (n.d.). Session replay. Recorded interactions and configuration. ↩

  13. OpenReplay. (2024, July 10). Heatmaps, cross-domain iFrame support, dashboard revamp, and more [v1.19 release]. Historical releases. ↩

  14. Sentry. (n.d.). Set Up Session Replay for Android. Sentry Docs. Interactions and network requests in mobile replay. ↩

  15. PostHog. (n.d.). Session replay and Product analytics. PostHog Docs. Session timeline and console/network data, funnels and retention. ↩

© 2025 borui. All rights reserved. This content may be freely reproduced, displayed, modified, or distributed with proper attribution to borui and a link to the article: borui (2025-05-14). From a click to a session replay: what does a frontend recorder actually collect?. https://caiborui.com/blog/2025-05-14-en-analytics-events-and-session-replay

@misc{borui2025-a0c03289,
  author = {borui},
  title = {{From a click to a session replay: what does a frontend recorder actually collect?}},
  year = {2025},
  publisher = {borui's blog},
  url = {https://caiborui.com/blog/2025-05-14-en-analytics-events-and-session-replay}
}