Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions plugins/optimization-detective/detect.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,11 @@ export default async function detect( {
return;
}

if ( document.visibilityState === 'hidden' && ! document.prerendering ) {
log( 'Page opened in background tab so URL Metric is not collected.' );
return;
}

// Abort if the current viewport is not among those which need URL Metrics.
const urlMetricGroupStatus = getGroupForViewportWidth(
win.innerWidth,
Expand Down
Loading