Skip to content

Comments

fix: rum instrumentation#36

Open
fkakatie wants to merge 1 commit intomainfrom
rum
Open

fix: rum instrumentation#36
fkakatie wants to merge 1 commit intomainfrom
rum

Conversation

@fkakatie
Copy link
Member

No description provided.

@aem-code-sync
Copy link

aem-code-sync bot commented Feb 23, 2023

Hello, I'm Franklin Bot and I will run some test suites that validate the page speed.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-run PSI Checks

Copy link

@trieloff trieloff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also add to loadLazy:

  sampleRUM('lazy');
  sampleRUM.observe(main.querySelectorAll('div[data-block-name]'));
  sampleRUM.observe(main.querySelectorAll('picture > img'));

from https://github.com/adobe/helix-project-boilerplate/blob/31c70e12527604005cf80a4d3830e1b71e04fbe9/scripts/scripts.js#L103-L105

and to loadDelayed()/delayed.js:

// Core Web Vitals RUM collection
sampleRUM('cwv');

from https://github.com/adobe/helix-project-boilerplate/blob/10c37787d5f8450d470cc13cc2af183f58bbb02f/scripts/delayed.js#L4-L5

And to 404.html:

  <script type="module">
    import { sampleRUM } from '/assets/scripts/scripts.js';

    window.addEventListener('load', () => {
      sampleRUM('404', { source: document.referrer, target: window.location.href });
    });
  </script>

from https://github.com/adobe/helix-project-boilerplate/blob/10c37787d5f8450d470cc13cc2af183f58bbb02f/404.html#L13-L31

Comment on lines +992 to +1000
window.addEventListener('load', () => sampleRUM('load'));

window.addEventListener('unhandledrejection', (event) => {
sampleRUM('error', { source: event.reason.sourceURL, target: event.reason.line });
});

window.addEventListener('error', (event) => {
sampleRUM('error', { source: event.filename, target: event.lineno });
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like to keep this just below the sampleRUM definition, so that the RUM code isn't as scattered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants