@adobe/helix-rum-enhancer 2.26.1 → 2.26.3

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,17 @@
1
+ ## [2.26.3](https://github.com/adobe/helix-rum-enhancer/compare/v2.26.2...v2.26.3) (2024-12-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * do not track repeating clicks ([#339](https://github.com/adobe/helix-rum-enhancer/issues/339)) ([f511a03](https://github.com/adobe/helix-rum-enhancer/commit/f511a03679188361326fbd3a8d68e650c39bea50))
7
+
8
+ ## [2.26.2](https://github.com/adobe/helix-rum-enhancer/compare/v2.26.1...v2.26.2) (2024-12-11)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * do not process duplicate navigation checkpoints ([#331](https://github.com/adobe/helix-rum-enhancer/issues/331)) ([4b6843f](https://github.com/adobe/helix-rum-enhancer/commit/4b6843f4cbe7b685ffc0c017a46274e505b26b56))
14
+
1
15
  ## [2.26.1](https://github.com/adobe/helix-rum-enhancer/compare/v2.26.0...v2.26.1) (2024-12-10)
2
16
 
3
17
 
package/modules/index.js CHANGED
@@ -145,13 +145,16 @@ function addNavigationTracking() {
145
145
  });
146
146
  };
147
147
 
148
+ const processed = new Set(); // avoid processing duplicate types
148
149
  new PerformanceObserver((list) => list
149
- .getEntries().map((e) => navigate(
150
+ .getEntries()
151
+ .filter(({ type }) => !processed.has(type))
152
+ .map((e) => [e, processed.add(e.type)])
153
+ .map(([e]) => navigate(
150
154
  window.hlx.referrer || document.referrer,
151
155
  e.type,
152
156
  e.redirectCount,
153
- )))
154
- .observe({ type: 'navigation', buffered: true });
157
+ ))).observe({ type: 'navigation', buffered: true });
155
158
  }
156
159
 
157
160
  function addLoadResourceTracking() {
@@ -282,8 +285,16 @@ function mediaMCB(mutations) {
282
285
  }
283
286
 
284
287
  function addTrackingFromConfig() {
288
+ let lastSource;
289
+ let lastTarget;
285
290
  document.addEventListener('click', (event) => {
286
- sampleRUM('click', { target: targetSelector(event.target), source: sourceSelector(event.target) });
291
+ const source = sourceSelector(event.target);
292
+ const target = targetSelector(event.target);
293
+ if (source !== lastSource || target !== lastTarget) {
294
+ sampleRUM('click', { target, source });
295
+ lastSource = source;
296
+ lastTarget = target;
297
+ }
287
298
  });
288
299
  addCWVTracking();
289
300
  addFormTracking(window.document.body);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "2.26.1",
3
+ "version": "2.26.3",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -43,7 +43,7 @@
43
43
  "@web/test-runner-commands": "0.9.0",
44
44
  "@web/test-runner-mocha": "0.9.0",
45
45
  "@web/test-runner-playwright": "0.11.0",
46
- "c8": "10.1.2",
46
+ "c8": "10.1.3",
47
47
  "codecov": "3.8.3",
48
48
  "eslint": "8.57.1",
49
49
  "eslint-plugin-header": "3.1.1",
@@ -51,7 +51,7 @@
51
51
  "husky": "9.1.7",
52
52
  "jsdoc-to-markdown": "9.1.1",
53
53
  "junit-report-builder": "5.1.1",
54
- "lint-staged": "15.2.10",
54
+ "lint-staged": "15.2.11",
55
55
  "mocha": "11.0.1",
56
56
  "mocha-multi-reporters": "1.5.1",
57
57
  "rollup": "4.28.1",
package/src/index.js CHANGED
@@ -293,13 +293,16 @@
293
293
  }
294
294
  });
295
295
  };
296
+ const processed = new Set();
296
297
  new PerformanceObserver((list) => list
297
- .getEntries().map((e) => navigate(
298
+ .getEntries()
299
+ .filter(({ type }) => !processed.has(type))
300
+ .map((e) => [e, processed.add(e.type)])
301
+ .map(([e]) => navigate(
298
302
  window.hlx.referrer || document.referrer,
299
303
  e.type,
300
304
  e.redirectCount,
301
- )))
302
- .observe({ type: 'navigation', buffered: true });
305
+ ))).observe({ type: 'navigation', buffered: true });
303
306
  }
304
307
  function addLoadResourceTracking() {
305
308
  const observer = new PerformanceObserver((list) => {
@@ -407,8 +410,16 @@
407
410
  });
408
411
  }
409
412
  function addTrackingFromConfig() {
413
+ let lastSource;
414
+ let lastTarget;
410
415
  document.addEventListener('click', (event) => {
411
- sampleRUM('click', { target: targetSelector(event.target), source: sourceSelector(event.target) });
416
+ const source = sourceSelector(event.target);
417
+ const target = targetSelector(event.target);
418
+ if (source !== lastSource || target !== lastTarget) {
419
+ sampleRUM('click', { target, source });
420
+ lastSource = source;
421
+ lastTarget = target;
422
+ }
412
423
  });
413
424
  addCWVTracking();
414
425
  addFormTracking(window.document.body);
package/src/index.md5 CHANGED
@@ -1 +1 @@
1
- 9516743215eadcd19f5b5cf311883d16
1
+ 6562b464055f9498b72eab295021c297