subcollection
Version:
A collection of scripts to send Core Web Vital data to GA4
20 lines (18 loc) • 520 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getLargestLayoutShiftSource = getLargestLayoutShiftSource;
/**
* Get LCP Debug Data
*
* @since 1.0.0
* @param {object} object The object to iterate over.
* @returns {Array} Returns the picked values.
*
*/
function getLargestLayoutShiftSource(sources) {
return sources.reduce(function (a, b) {
return a.node && a.previousRect.width * a.previousRect.height > b.previousRect.width * b.previousRect.height ? a : b;
});
}