Helix RUM Event Generator for JavaScript
If you want to collect a RUM event programmatically, use this in your JavaScript code:
import { sampleRUM } from 'https://rum.hlx.page/.rum/@adobe/helix-rum-js@^1/src/index.js';
sampleRUM('top');
window.addEventListener('load', () => sampleRUM('load'));
document.addEventListener('click', () => sampleRUM('click'));
You can pin a version number by using a URL like https://rum.hlx.page/.rum/@adobe/[email protected]/src/index.js
instead.
To enable advanced RUM functionality, such as reporting of Core Web Vitals, fire the lazy
checkpoint as soon as your render-critical Javascript has executed.
// after all render-critical Javascript has been run
sampleRUM('lazy');
For usage of the sampleRUM
function, follow the API documentation.
$ npm install
$ npm test
$ npm run lint