@adobe/spacecat-shared-rum-api-client 2.27.1 → 2.28.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,17 @@
1
+ # [@adobe/spacecat-shared-rum-api-client-v2.28.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.27.2...@adobe/spacecat-shared-rum-api-client-v2.28.0) (2025-05-30)
2
+
3
+
4
+ ### Features
5
+
6
+ * filter pages under experiment ([#772](https://github.com/adobe/spacecat-shared/issues/772)) ([af63666](https://github.com/adobe/spacecat-shared/commit/af636667a38602a848624567ddcd37adba931597))
7
+
8
+ # [@adobe/spacecat-shared-rum-api-client-v2.27.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.27.1...@adobe/spacecat-shared-rum-api-client-v2.27.2) (2025-05-27)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * disregarding CTAs without a valid source for low nav opportunities ([#769](https://github.com/adobe/spacecat-shared/issues/769)) ([1dc5d30](https://github.com/adobe/spacecat-shared/commit/1dc5d30ddaa4291061ea29c52c797aa6cfdca670))
14
+
1
15
  # [@adobe/spacecat-shared-rum-api-client-v2.27.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.27.0...@adobe/spacecat-shared-rum-api-client-v2.27.1) (2025-05-26)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-rum-api-client",
3
- "version": "2.27.1",
3
+ "version": "2.28.0",
4
4
  "description": "Shared modules of the Spacecat Services - Rum API client",
5
5
  "type": "module",
6
6
  "engines": {
@@ -10,12 +10,12 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { DataChunks } from '@adobe/rum-distiller';
13
+ import { DataChunks, facets } from '@adobe/rum-distiller';
14
14
  import trafficAcquisition from './traffic-acquisition.js';
15
- import { generateKey, DELIMITER, loadBundles } from '../utils.js';
15
+ import { DELIMITER, generateKey, loadBundles } from '../utils.js';
16
16
 
17
17
  const METRICS = ['formview', 'formengagement', 'formsubmit'];
18
- const CHECKPOINTS = ['viewblock', 'click', 'fill', 'formsubmit', 'navigate', 'viewmedia'];
18
+ const CHECKPOINTS = ['viewblock', 'click', 'fill', 'formsubmit', 'navigate', 'viewmedia', 'experiment'];
19
19
  const KEYWORDS_TO_FILTER = ['search'];
20
20
 
21
21
  function initializeResult(url) {
@@ -37,7 +37,7 @@ function filterEvents(bundles) {
37
37
  return false;
38
38
  }
39
39
 
40
- if (event.checkpoint === 'navigate') {
40
+ if (event.checkpoint === 'navigate' || event.checkpoint === 'experiment') {
41
41
  return true;
42
42
  }
43
43
 
@@ -81,6 +81,18 @@ function findByUrl(formVitals, url) {
81
81
  return Object.values(formVitals).find((item) => item.url === url);
82
82
  }
83
83
 
84
+ function getAllURLWithExperiment(bundles) {
85
+ const dataChunks = new DataChunks();
86
+ loadBundles(bundles, dataChunks);
87
+ const { checkpoint } = facets;
88
+ dataChunks.addFacet('checkpoint', checkpoint);
89
+ return new Set(
90
+ dataChunks.facets.checkpoint
91
+ .filter((cp) => cp.value === 'experiment')
92
+ .flatMap((_checkpoint) => _checkpoint.entries.map((_entry) => _entry.url)),
93
+ );
94
+ }
95
+
84
96
  function populateFormsInternalNavigation(bundles, formVitals) {
85
97
  const dataChunks = new DataChunks();
86
98
  loadBundles(bundles, dataChunks);
@@ -114,7 +126,7 @@ function findFormCTAForInternalNavigation(bundles, formVitals) {
114
126
  totalClickOnPage += bundle.weight;
115
127
  const clickCheckpoint = bundle.events.find((e) => e.checkpoint === 'click' && e.target === url);
116
128
 
117
- if (clickCheckpoint) {
129
+ if (clickCheckpoint && clickCheckpoint.source) {
118
130
  const { source } = clickCheckpoint;
119
131
  // Retrieves the existing CTA object if it exists; otherwise,
120
132
  // initializes a new one with default values.
@@ -139,6 +151,10 @@ function containsFormVitals(row) {
139
151
  return METRICS.some((metric) => Object.keys(row[metric]).length > 0);
140
152
  }
141
153
 
154
+ function isUnderExperiment(row, experimentUrls) {
155
+ return experimentUrls.has(row.url);
156
+ }
157
+
142
158
  function getParentPageVitalsGroupedByIFrame(bundles, dataChunks, iframeParentMap) {
143
159
  const iframeVitals = {};
144
160
  if (dataChunks.facets.urlUserAgents) {
@@ -275,10 +291,14 @@ function handler(bundles) {
275
291
  iframeParentMapWithoutDuplicates,
276
292
  );
277
293
 
294
+ const experimentUrls = getAllURLWithExperiment(bundlesWithFilteredEvents);
295
+
278
296
  // populate internal navigation data
279
297
  populateFormsInternalNavigation(bundles, formVitals);
280
298
  // filter out pages with no form vitals
281
- const filteredFormVitals = Object.values(formVitals).filter(containsFormVitals);
299
+ const filteredFormVitals = Object.values(formVitals).filter(
300
+ (formVital) => containsFormVitals(formVital) && !isUnderExperiment(formVital, experimentUrls),
301
+ );
282
302
  findFormCTAForInternalNavigation(bundles, filteredFormVitals);
283
303
 
284
304
  const updatedFormVitals = filteredFormVitals.map((formVital) => {