@adobe/spacecat-shared-rum-api-client 2.22.3 → 2.22.4
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 +7 -0
- package/package.json +1 -1
- package/src/functions/form-vitals.js +29 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-rum-api-client-v2.22.4](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.22.3...@adobe/spacecat-shared-rum-api-client-v2.22.4) (2025-04-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* filter search form events ([#689](https://github.com/adobe/spacecat-shared/issues/689)) ([abde8cd](https://github.com/adobe/spacecat-shared/commit/abde8cd47f98f4aa5753a3105e8a54df4caffa07))
|
|
7
|
+
|
|
1
8
|
# [@adobe/spacecat-shared-rum-api-client-v2.22.3](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.22.2...@adobe/spacecat-shared-rum-api-client-v2.22.3) (2025-04-11)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -14,8 +14,10 @@ import { DataChunks } from '@adobe/rum-distiller';
|
|
|
14
14
|
import trafficAcquisition from './traffic-acquisition.js';
|
|
15
15
|
import { generateKey, DELIMITER, loadBundles } from '../utils.js';
|
|
16
16
|
|
|
17
|
-
const FORM_SOURCE = [
|
|
17
|
+
const FORM_SOURCE = [/\bform\b/, /\.marketo/];
|
|
18
18
|
const METRICS = ['formview', 'formengagement', 'formsubmit', 'formbuttonclick'];
|
|
19
|
+
const CHECKPOINTS = ['viewblock', 'click', 'fill', 'formsubmit', 'navigate'];
|
|
20
|
+
const KEYWORDS_TO_FILTER = ['search'];
|
|
19
21
|
|
|
20
22
|
function initializeResult(url) {
|
|
21
23
|
return {
|
|
@@ -29,9 +31,29 @@ function initializeResult(url) {
|
|
|
29
31
|
};
|
|
30
32
|
}
|
|
31
33
|
|
|
34
|
+
function filterEvents(bundles) {
|
|
35
|
+
return bundles.map((bundle) => ({
|
|
36
|
+
...bundle,
|
|
37
|
+
events: bundle.events.filter((event) => {
|
|
38
|
+
if (!CHECKPOINTS.includes(event.checkpoint)) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (event.checkpoint === 'navigate') {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const isFormRelatedEvent = ['fill', 'formsubmit'].includes(event.checkpoint)
|
|
47
|
+
|| /\bform\b/.test(event.source);
|
|
48
|
+
return isFormRelatedEvent && !KEYWORDS_TO_FILTER.some((keyword) => event.source
|
|
49
|
+
&& event.source.toLowerCase().includes(keyword));
|
|
50
|
+
}),
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
|
|
32
54
|
const metricFns = {
|
|
33
55
|
formview: (bundle) => {
|
|
34
|
-
const formView = bundle.events.find((e) => e.checkpoint === 'viewblock' && FORM_SOURCE.
|
|
56
|
+
const formView = bundle.events.find((e) => e.checkpoint === 'viewblock' && FORM_SOURCE.some((regex) => regex.test(e.source)));
|
|
35
57
|
return formView ? bundle.weight : 0;
|
|
36
58
|
},
|
|
37
59
|
formengagement: (bundle) => {
|
|
@@ -106,8 +128,11 @@ function containsFormVitals(row) {
|
|
|
106
128
|
}
|
|
107
129
|
|
|
108
130
|
function handler(bundles) {
|
|
131
|
+
// Filter out search related events
|
|
132
|
+
const bundlesWithFilteredEvents = filterEvents(bundles);
|
|
133
|
+
|
|
109
134
|
const dataChunks = new DataChunks();
|
|
110
|
-
loadBundles(
|
|
135
|
+
loadBundles(bundlesWithFilteredEvents, dataChunks);
|
|
111
136
|
|
|
112
137
|
// groups by url and user agent
|
|
113
138
|
dataChunks.addFacet('urlUserAgents', (bundle) => generateKey(bundle.url, bundle.userAgent));
|
|
@@ -147,5 +172,5 @@ function handler(bundles) {
|
|
|
147
172
|
|
|
148
173
|
export default {
|
|
149
174
|
handler,
|
|
150
|
-
checkpoints:
|
|
175
|
+
checkpoints: CHECKPOINTS,
|
|
151
176
|
};
|