From 313b22438cd60800ccece67e2ae1e5b802211572 Mon Sep 17 00:00:00 2001 From: Billy Date: Tue, 22 Aug 2023 15:11:15 -0700 Subject: [PATCH] chore: update LCP, CLS, and FID schemas with attributions --- .../cumulative-layout-shift-event.json | 31 ++++++++++++++- .../first-input-delay-event.json | 32 ++++++++++++++- .../largest-contentful-paint-event.json | 39 ++++++++++++++++++- 3 files changed, 99 insertions(+), 3 deletions(-) diff --git a/src/event-schemas/cumulative-layout-shift-event.json b/src/event-schemas/cumulative-layout-shift-event.json index 900c20e2..78bc21a3 100644 --- a/src/event-schemas/cumulative-layout-shift-event.json +++ b/src/event-schemas/cumulative-layout-shift-event.json @@ -11,7 +11,36 @@ }, "value": { "type": "number", - "description": "Value of the cls metric" + "description": "Largest burst of unexpected layout shifts during a page's lifespan" + }, + "attribution": { + "type": "object", + "description": "Attributions for CLS", + "properties": { + "largestShiftTarget": { + "type": "string", + "description": "First element in the largest layout shift contributing to CLS score" + }, + "largestShiftValue": { + "type": "number", + "description": "Value of CLS' single largest shift" + }, + "largestShiftTime": { + "type": "number", + "description": "DOMHighResTimeStamp of CLS' single largest shift" + }, + "loadState": { + "type": "string", + "enum": [ + "loading", + "dom-interactive", + "dom-content-loaded", + "complete" + ], + "description": "LoadState during CLS' single largest shift" + } + }, + "additionalProperties": false } }, "additionalProperties": false, diff --git a/src/event-schemas/first-input-delay-event.json b/src/event-schemas/first-input-delay-event.json index 59afcd3f..419cf778 100644 --- a/src/event-schemas/first-input-delay-event.json +++ b/src/event-schemas/first-input-delay-event.json @@ -11,7 +11,37 @@ }, "value": { "type": "number", - "description": "Value of the fid metric" + "description": "Time from first user interaction until the main thread is next idle" + }, + "attribution": { + "type": "object", + "description": "Attributions for FID", + "properties": { + "eventTarget": { + "type": "string", + "description": "Selector of the element targeted by first user interaction" + }, + "eventType": { + "type": "string", + "description": "Type of event dispatched by first user interaction" + }, + "eventTime": { + "type": "number", + "description": "Timestamp of user first user interaction" + }, + "loadState": { + "type": "string", + "enum": [ + "loading", + "dom-interactive", + "dom-content-loaded", + "complete" + ], + "description": "LoadState of the document during first user interaction" + } + }, + "required": ["eventTarget", "eventType", "eventTime", "loadState"], + "additionalProperties": false } }, "additionalProperties": false, diff --git a/src/event-schemas/largest-contentful-paint-event.json b/src/event-schemas/largest-contentful-paint-event.json index e3fda0fd..cd64b1b5 100644 --- a/src/event-schemas/largest-contentful-paint-event.json +++ b/src/event-schemas/largest-contentful-paint-event.json @@ -11,7 +11,44 @@ }, "value": { "type": "number", - "description": "Value of the lcp metric" + "description": "Time until the largest element before first user interaction is rendered" + }, + "attribution": { + "type": "object", + "description": "Attributions for CLS", + "properties": { + "element": { + "type": "string", + "description": "CSS selector of LCP resource" + }, + "url": { + "type": "string", + "description": "URL source of the LCP resource's image, if any" + }, + "timeToFirstByte": { + "type": "number", + "description": "Duration until first byte of response" + }, + "resourceLoadDelay": { + "type": "number", + "description": "Duration after TTFP until LCP resource begins loading" + }, + "resourceLoadTime": { + "type": "number", + "description": "Duration loading the LCP resource" + }, + "elementRenderDelay": { + "type": "number", + "description": "Duration rendering the LCP resource" + } + }, + "required": [ + "timeToFirstByte", + "resourceLoadDelay", + "resourceLoadTime", + "elementRenderDelay" + ], + "additionalProperties": false } }, "additionalProperties": false,