Closed
Description
We want to start capturing what we assume could be dead clicks as replay breadcrumbs.
For now, we will do nothing with this but capture it, so we can evaluate this.
Capture logic
We will add a global click handler on button,a,input[type="button"],input[type="submit"]
. When such an element is clicked, we will start watching for any mutation on the page via a mutation observer, and start a timer. When the next mutation after the click is > 1s after the click, we will capture a replay breadcrumb with the actual time it took until the next mutation, timing out after a maximum of 5s.
Breadcrumb format
type Breadcrumb = {
category: 'replay.slowClickDetected',
timestamp: number, // time of click
data: {
timeAfterClickMs: number, // how long until mutation happened, in ms - capped at 5000
url: string, // URL of the page at the time of click
route: string | undefined, // parametrized route of the URL at the time of click. This only works when performance is enabled!,
endReason: string, // the reason why the click timer was ended. e.g.: timeout, scroll, mutation, urlChange
}