adobe / helix-rum-enhancer

Add advanced functionality to Helix RUM Collection (client-side)
Apache License 2.0
1 stars 14 forks source link
helix real-user-monitoring

Helix RUM Enhancer

Add advanced functionality to Helix RUM Collection (client-side)

Status

codecov GitHub Actions GitHub license GitHub issues semantic-release

Usage

This library is meant to be used in conjunction with and loaded by the sampleRUM function found in Helix Project Boilerplate or Helix RUM JS.

It will add following new checkpoints:

The source parameter and the sourceSelector

The source parameter is a string that can be used to identify the source of the event. It can be used to identify the source of the event, e.g. a button, a link, a form, etc. It represents an idealized CSS selector that is both human-readable and specific enough to identify the source of the event in the document, even when not having access to the orginal document. It is idealized because it pretends the DOM would use modern HTML with concise semantics, even if the actual document uses class values for things that would be better represented by semantic HTML elements.

The sourceSelector function is a function that takes a DOM element and returns a descriptive source parameter. If the element has a data-rum-source attribute, its value is used as the source parameter. Otherwise, the function tries to generate a source parameter based on the element's tag name, class names, and text content.

The structure of the source parameter is as follows:

<context> <element>#<identifier>

All three parts are optional

context is

element is

identifier is

Even if an identifier is provided, having a context and element is recommended, as it makes the source parameter more readable and easier to understand.

Examples

Development

Build

$ npm install

Test

$ npm test

Lint

$ npm run lint