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