diff --git a/scripts/delayed.js b/scripts/delayed.js index 4f632597be..28fa26c8e2 100644 --- a/scripts/delayed.js +++ b/scripts/delayed.js @@ -1,7 +1 @@ -// eslint-disable-next-line import/no-cycle -import { sampleRUM } from './aem.js'; - -// Core Web Vitals RUM collection -sampleRUM('cwv'); - -// add more delayed functionality here +// add delayed functionality here diff --git a/scripts/scripts.js b/scripts/scripts.js index d47e412452..a76308bcc2 100644 --- a/scripts/scripts.js +++ b/scripts/scripts.js @@ -1,5 +1,4 @@ import { - sampleRUM, buildBlock, loadHeader, loadFooter, @@ -12,6 +11,7 @@ import { loadSection, loadSections, loadCSS, + sampleRUM, } from './aem.js'; /** @@ -82,6 +82,8 @@ async function loadEager(doc) { await loadSection(main.querySelector('.section'), waitForFirstImage); } + sampleRUM.enhance(); + try { /* if desktop (proxy for fast connection) or fonts already loaded, load fonts.css */ if (window.innerWidth >= 900 || sessionStorage.getItem('fonts-loaded')) { @@ -109,10 +111,6 @@ async function loadLazy(doc) { loadCSS(`${window.hlx.codeBasePath}/styles/lazy-styles.css`); loadFonts(); - - sampleRUM('lazy'); - sampleRUM.observe(main.querySelectorAll('div[data-block-name]')); - sampleRUM.observe(main.querySelectorAll('picture > img')); } /**