Scully Helped us Reach a 99 Lighthouse Score for a B2C Platform

import { registerPlugin, getMyConfig } from '@scullyio/scully';export const GoogleAnalytics = 'googleAnalytics';export const googleAnalyticsPlugin = async (html: string): Promise<string> => {
const googleAnalyticsConfig = getMyConfig(googleAnalyticsPlugin);
if (!googleAnalyticsConfig || !googleAnalyticsConfig['globalSiteTag']) {
throw new Error('googleAnalytics plugin missing Global Site Tag');
}
const siteTag: string = googleAnalyticsConfig['globalSiteTag']; // your gtmTagId
const googleAnalyticsScript = `
// your GA script code here
`;
return html.replace(/<\/head/i, `${googleAnalyticsScript}</head`);
};
const validator = async () => [];registerPlugin('postProcessByHtml', GoogleAnalytics, googleAnalyticsPlugin, validator);

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store