@adobe/helix-rum-enhancer 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # [2.1.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.0.0...v2.1.0) (2024-01-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **loadresource:** enable loadresource checkpoint for all origins ([0be8de7](https://github.com/adobe/helix-rum-enhancer/commit/0be8de7ee3e57afdd60a2b9af743bedd061e907d))
7
+
8
+
9
+ ### Features
10
+
11
+ * **observer:** enable tracking of JSON loading for all browsers that have a PerformanceObserver implementation ([45b5e64](https://github.com/adobe/helix-rum-enhancer/commit/45b5e6428fb9c51e8fc4d477c574d44a361b3ec2))
12
+
1
13
  # [2.0.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.9.1...v2.0.0) (2024-01-16)
2
14
 
3
15
 
package/README.md CHANGED
@@ -4,10 +4,9 @@
4
4
 
5
5
  ## Status
6
6
  [![codecov](https://img.shields.io/codecov/c/github/adobe/helix-rum-enhancer.svg)](https://codecov.io/gh/adobe/helix-rum-enhancer)
7
- [![CircleCI](https://img.shields.io/circleci/project/github/adobe/helix-rum-enhancer.svg)](https://circleci.com/gh/adobe/helix-rum-enhancer)
7
+ [![GitHub Actions](https://img.shields.io/github/actions/workflow/status/adobe/helix-rum-enhancer/main.yaml)](https://github.com/adobe/helix-rum-enhancer/actions/workflows/main.yaml)
8
8
  [![GitHub license](https://img.shields.io/github/license/adobe/helix-rum-enhancer.svg)](https://github.com/adobe/helix-rum-enhancer/blob/master/LICENSE.txt)
9
9
  [![GitHub issues](https://img.shields.io/github/issues/adobe/helix-rum-enhancer.svg)](https://github.com/adobe/helix-rum-enhancer/issues)
10
- [![LGTM Code Quality Grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/adobe/helix-rum-enhancer.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/adobe/helix-rum-enhancer)
11
10
  [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
12
11
 
13
12
  ## Usage
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -9,6 +9,7 @@
9
9
  "lint": "eslint .",
10
10
  "docs": "npx jsdoc2md -c .jsdoc.json --files 'src/*.js' > docs/API.md",
11
11
  "semantic-release": "semantic-release",
12
+ "semantic-release-dry": "semantic-release --dry-run --branches $CI_BRANCH",
12
13
  "prepare": "husky install"
13
14
  },
14
15
  "repository": {
package/src/index.js CHANGED
@@ -11,7 +11,7 @@
11
11
  */
12
12
  /* eslint-env browser */
13
13
  const KNOWN_PROPERTIES = ['weight', 'id', 'referer', 'checkpoint', 't', 'source', 'target', 'cwv', 'CLS', 'FID', 'LCP', 'INP', 'TTFB'];
14
- const DEFAULT_TRACKING_EVENTS = ['click', 'cwv', 'form', 'enterleave', 'viewblock', 'viewmedia'];
14
+ const DEFAULT_TRACKING_EVENTS = ['click', 'cwv', 'form', 'enterleave', 'viewblock', 'viewmedia', 'loadresource'];
15
15
  const SESSION_STORAGE_KEY = 'aem-rum';
16
16
  const { sampleRUM, queue, isSelected } = window.hlx.rum;
17
17
 
@@ -67,10 +67,6 @@ function optedIn(checkpoint, data) {
67
67
  }
68
68
  // Gets configured collection from the config service for the current domain
69
69
  function getCollectionConfig() {
70
- if (window.location.hostname === 'blog.adobe.com') {
71
- return ['loadresource', ...DEFAULT_TRACKING_EVENTS];
72
- }
73
- // TODO: configured collection should come from config service
74
70
  return DEFAULT_TRACKING_EVENTS;
75
71
  }
76
72
 
@@ -157,18 +153,16 @@ function addEnterLeaveTracking() {
157
153
  }
158
154
 
159
155
  function addLoadResourceTracking() {
160
- if (window.location.hostname === 'blog.adobe.com') {
161
- const observer = new PerformanceObserver((list) => {
162
- list.getEntries()
163
- .filter((entry) => !entry.responseStatus || entry.responseStatus < 400)
164
- .filter((entry) => window.location.hostname === new URL(entry.name).hostname)
165
- .filter((entry) => new URL(entry.name).pathname.match('.*(\\.plain\\.html|\\.json)$'))
166
- .forEach((entry) => {
167
- sampleRUM('loadresource', { source: entry.name, target: Math.round(entry.duration) });
168
- });
169
- });
170
- observer.observe({ type: 'resource', buffered: true });
171
- }
156
+ const observer = new PerformanceObserver((list) => {
157
+ list.getEntries()
158
+ .filter((entry) => !entry.responseStatus || entry.responseStatus < 400)
159
+ .filter((entry) => window.location.hostname === new URL(entry.name).hostname)
160
+ .filter((entry) => new URL(entry.name).pathname.match('.*(\\.plain\\.html|\\.json)$'))
161
+ .forEach((entry) => {
162
+ sampleRUM('loadresource', { source: entry.name, target: Math.round(entry.duration) });
163
+ });
164
+ });
165
+ observer.observe({ type: 'resource', buffered: true });
172
166
  }
173
167
 
174
168
  function activateBlocksMutationObserver() {