From 524a2ced234c8e24f3d636bc1c7a69ffef4f57ad Mon Sep 17 00:00:00 2001 From: "jordi.munoz@adevinta.com" Date: Mon, 4 Dec 2023 10:24:40 +0100 Subject: [PATCH] feat(packages/sui-react-web-vitals): add routeId field to logger --- packages/sui-react-web-vitals/src/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/sui-react-web-vitals/src/index.js b/packages/sui-react-web-vitals/src/index.js index aa1ee42ea..291fd5fcc 100644 --- a/packages/sui-react-web-vitals/src/index.js +++ b/packages/sui-react-web-vitals/src/index.js @@ -96,7 +96,8 @@ export default function WebVitalsReporter({ const handleAllChanges = ({attribution, name, rating, value}) => { const amount = name === METRICS.CLS ? value * 1000 : value const pathname = getPathname(route) - const isAllowed = allowed.includes(pathname) + const routeid = getRouteid() + const isAllowed = allowed.includes(pathname) || allowed.includes(routeid) if (!isAllowed || !logger?.cwv || rating === RATING.GOOD) return @@ -106,6 +107,7 @@ export default function WebVitalsReporter({ name: `cwv.${name.toLowerCase()}`, amount, path: pathname, + routeId: routeid, target, loadState: attribution.loadState, visibilityState: document.visibilityState,