coach-core
Version:
Core package for the Coach.
30 lines (26 loc) • 1.01 kB
JavaScript
(function (util) {
'use strict';
const scripts = util.getSynchJSFiles(document.head);
const offending = [];
let score = 100;
let advice = '';
scripts.forEach(function (script) {
if (util.getHostname(script) === 'cdn.optimizely.com') {
offending.push(script);
score = 0;
advice =
'The page is using Optimizely. Use it with care because it hurts your performance. Only turn it on (= load the JavaScript) when you run your A/B tests. Then when you are finished make sure to turn it off.';
}
});
return {
id: 'optimizely',
title: 'Only use Optimizely when you need it',
description:
'Use Optimizely with care because it hurts your performance since JavaScript is loaded synchronously inside of the head tag, making the first paint happen later. Only turn on Optimzely (= load the javascript) when you run your A/B tests.',
advice: advice,
score: score,
weight: 2,
offending: offending,
tags: ['bestpractice']
};
})(util);