Skip to content

Commit

Permalink
Merge pull request #1727 from SUI-Components/feat/cwv-skip-empty-target
Browse files Browse the repository at this point in the history
feat(packages/sui-react-web-vitals): skip empty targets
  • Loading branch information
Joan León authored Feb 12, 2024
2 parents 6a5d77d + 0ae4b24 commit a94d336
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/sui-react-web-vitals/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ export default function WebVitalsReporter({
const pathname = getPathname(route)
const routeid = getRouteid()
const isAllowed = allowed.includes(pathname) || allowed.includes(routeid)
const target = getTarget({name, attribution})

if (!isAllowed || !logger?.cwv || rating === RATING.GOOD) return
if (!isAllowed || !logger?.cwv || rating === RATING.GOOD || !target) return

const target = getTarget({name, attribution})
const {loadState, eventType} = attribution

logger.cwv({
Expand Down

0 comments on commit a94d336

Please sign in to comment.