@adobe/helix-rum-enhancer 1.13.2 → 1.15.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 +19 -0
- package/package.json +3 -3
- package/src/index.js +16 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
# [1.15.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.14.0...v1.15.0) (2024-04-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add logic to capture target from wrapping anchor tag ([9f40d95](https://github.com/adobe/helix-rum-enhancer/commit/9f40d951021aa452b0cb8020c8ef1c2f5e68d069))
|
|
7
|
+
|
|
8
|
+
# [1.14.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.13.2...v1.14.0) (2024-04-16)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* pr reviews ([8c1a9ae](https://github.com/adobe/helix-rum-enhancer/commit/8c1a9ae8af07baf9d230a428d612f6e9693ca692))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* report source and target along with lcp event ([5846b71](https://github.com/adobe/helix-rum-enhancer/commit/5846b7110d0acda3789274ddf6b5d3ac43d196eb))
|
|
19
|
+
|
|
1
20
|
## [1.13.2](https://github.com/adobe/helix-rum-enhancer/compare/v1.13.1...v1.13.2) (2024-03-27)
|
|
2
21
|
|
|
3
22
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-rum-enhancer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"description": "Helix RUM Enhancer",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"jsdoc-to-markdown": "8.0.1",
|
|
43
43
|
"junit-report-builder": "3.2.1",
|
|
44
44
|
"lint-staged": "15.2.2",
|
|
45
|
-
"mocha": "10.
|
|
45
|
+
"mocha": "10.4.0",
|
|
46
46
|
"mocha-multi-reporters": "1.5.1",
|
|
47
|
-
"semantic-release": "
|
|
47
|
+
"semantic-release": "23.0.8"
|
|
48
48
|
},
|
|
49
49
|
"lint-staged": {
|
|
50
50
|
"*.js": "eslint",
|
package/src/index.js
CHANGED
|
@@ -67,8 +67,15 @@ new PerformanceObserver((list) => list
|
|
|
67
67
|
.observe({ type: 'navigation', buffered: true });
|
|
68
68
|
|
|
69
69
|
sampleRUM.targetselector = (element) => {
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
const getTargetValue = (el) => el.getAttribute('data-rum-target') || el.getAttribute('href')
|
|
71
|
+
|| el.currentSrc || el.getAttribute('src')
|
|
72
|
+
|| el.dataset.action || el.action;
|
|
73
|
+
|
|
74
|
+
let value = getTargetValue(element);
|
|
75
|
+
if (!value && element.tagName !== 'A' && element.closest('a')) {
|
|
76
|
+
value = getTargetValue(element.closest('a'));
|
|
77
|
+
}
|
|
78
|
+
|
|
72
79
|
if (value && !value.startsWith('https://')) {
|
|
73
80
|
// resolve relative links
|
|
74
81
|
value = new URL(value, window.location).href;
|
|
@@ -89,6 +96,13 @@ sampleRUM.drain('cwv', (() => {
|
|
|
89
96
|
const storeCWV = (measurement) => {
|
|
90
97
|
const data = { cwv: {} };
|
|
91
98
|
data.cwv[measurement.name] = measurement.value;
|
|
99
|
+
|
|
100
|
+
if (measurement.name === 'LCP' && measurement.entries.length > 0) {
|
|
101
|
+
const { element } = measurement.entries.pop();
|
|
102
|
+
data.target = sampleRUM.targetselector(element);
|
|
103
|
+
data.source = sampleRUM.sourceselector(element) || element.outerHTML.slice(0, 30);
|
|
104
|
+
}
|
|
105
|
+
|
|
92
106
|
sampleRUM('cwv', data);
|
|
93
107
|
};
|
|
94
108
|
|