@adobe/helix-rum-enhancer

中文文档
2.51.0发布于 2026/10/29Apache-2.0ES Module零依赖构建来源已验证近 30 天下载 3176

Helix RUM Enhancer

原始使用文档
文档目录8 节
  1. Status
  2. Usage
  3. The source parameter and the sourceSelector
  4. Development
  5. Build
  6. Test
  7. Lint
  8. Cutting a Pre-Release

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:

  • cwv: Core Web Vitals Collection
  • pagesviewed: number that helps to estimate how many pages are seen in average by a user.
  • click: A click anywhere in the document
  • viewblock: A Helix block has been scrolled into the viewport
  • viewmedia: An image or video hosted by Helix Media Bus has been scrolled into the viewport
  • reload, navigate, enter: depending on how the current page was accessed
  • formsubmit: when a form is submitted

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

  • form for form elements
  • dialog for dialog elements, or parent containers that are fixed positioned and have a positive high z-index
  • .block-name for Helix blocks
  • header, footer, nav, aside for main site structure
  • #id as a fallback, if a container ID is available

element is

  • button for buttons, or links that look like buttons (e.g. with a class button or btn or cta)
  • img for images
  • video for videos
  • a for links that are not buttons
  • input[type="text"] for input elements (all types are supported)
  • select, textarea, etc. for other form elements

identifier is

  • the id attribute of the element, if provided
  • the first .class if there are any
  • else omitted

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.

Development

Build

$ npm install

Test

$ npm test

Lint

$ npm run lint

Cutting a Pre-Release

Releases are handled by semantic-release, and will happen automatically when a PR is merged into the main or the 1.x branch. By merging into beta, a pre-release will be created.

版本与发布记录

@adobe/helix-rum-enhancer 共发布 157 个版本,首次发布于 2022/07/08;过去 12 个月发布了 15 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.51.0latest2026/10/299 天前
2.50.12026/10/2711 天前
2.50.02026/07/263 个月前
2.49.02026/07/103 个月前
2.48.02026/07/093 个月前
2.47.32026/05/135 个月前

其他发布通道:release-1.x → 1.23.1,beta → 2.31.1-beta.1。

关于 @adobe/helix-rum-enhancer 的常见问题

@adobe/helix-rum-enhancer 是什么?

Helix RUM Enhancer

如何安装 @adobe/helix-rum-enhancer?

在项目目录运行 npm install @adobe/helix-rum-enhancer,或使用 pnpm add / yarn add / bun add。

@adobe/helix-rum-enhancer 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/adobe__helix-rum-enhancer 是否存在。

@adobe/helix-rum-enhancer 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@adobe/helix-rum-enhancer 可以商用吗?

@adobe/helix-rum-enhancer 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@adobe/helix-rum-enhancer 的下载量有多少?

根据 npm 官方下载统计,@adobe/helix-rum-enhancer 在 2026/10/05 – 2026/11/03 这 30 天内被下载 3,176 次,日均约 106 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@adobe/helix-rum-enhancer 还在维护吗?

最新版本 2.51.0 发布于 2026/10/29(9 天前);至今共发布 157 个版本,其中过去 12 个月发布了 15 个;首次发布于 2022/07/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。