subcollection
Version:
A collection of scripts to send Core Web Vital data to GA4
31 lines (25 loc) • 649 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getFIDRating = getFIDRating;
var _getConstants = require("./getConstants");
/**
* getFIDRating
* Determines whether a FID score is good, average, or poor.
*
* @param {number} value value of the FID metric
* @returns {string} the string value rating
*/
function getFIDRating(value) {
if (value < 0 || typeof value !== 'number') {
return _getConstants.NO_RATING;
}
if (value <= 100) {
return _getConstants.GOOD_SCORE;
}
if (value > 100 && value < 300) {
return _getConstants.AVERAGE_SCORE;
}
return _getConstants.POOR_SCORE;
}