@adobe/spacecat-shared-rum-api-client 2.36.4 → 2.36.5

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,10 @@
1
+ # [@adobe/spacecat-shared-rum-api-client-v2.36.5](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.36.4...@adobe/spacecat-shared-rum-api-client-v2.36.5) (2025-08-25)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * make max opportunities configurable ([#930](https://github.com/adobe/spacecat-shared/issues/930)) ([2b18c25](https://github.com/adobe/spacecat-shared/commit/2b18c25e8dc3303af0e1a09ebcbe830672368d13))
7
+
1
8
  # [@adobe/spacecat-shared-rum-api-client-v2.36.4](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.36.3...@adobe/spacecat-shared-rum-api-client-v2.36.4) (2025-08-15)
2
9
 
3
10
 
package/README.md CHANGED
@@ -335,7 +335,13 @@ Calculates the amount of inorganic traffic and the bounce rate for each page. Id
335
335
 
336
336
  ### high-organic-low-ctr (Experimentation Opportunity)
337
337
 
338
- Calculates the amount of non-inorganic (earned and owned) traffic and the click-through rate for each page and vendor. Identifies pages with high non-inorganic traffic and low click-through rates, which can be targeted for future experimentation opportunities. An example payload is provided below:
338
+ Calculates the amount of non-inorganic (earned and owned) traffic and the click-through rate for each page and vendor. Identifies pages with high non-inorganic traffic and low click-through rates, which can be targeted for future experimentation opportunities.
339
+
340
+ #### options supported
341
+ - **maxOpportunities** - No. of maximum opportunities to return, defaults to 10
342
+
343
+
344
+ An example payload is provided below:
339
345
 
340
346
  ```json
341
347
  [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-rum-api-client",
3
- "version": "2.36.4",
3
+ "version": "2.36.5",
4
4
  "description": "Shared modules of the Spacecat Services - Rum API client",
5
5
  "type": "module",
6
6
  "engines": {
@@ -14,7 +14,7 @@ import trafficAcquisition from '../traffic-acquisition.js';
14
14
  import { getCTRByUrlAndVendor, getSiteAvgCTR } from '../../common/aggregateFns.js';
15
15
 
16
16
  const VENDORS_TO_CONSIDER = 5;
17
- const MAX_OPPORTUNITIES = 10;
17
+ const DEFAULT_MAX_OPPORTUNITIES = 10;
18
18
 
19
19
  const MAIN_TYPES = ['paid', 'earned', 'owned'];
20
20
 
@@ -133,13 +133,13 @@ function sortPagesByEarnedAndOverallTraffic(pages) {
133
133
  return percentiles.sort((a, b) => b.percentileScore - a.percentileScore);
134
134
  }
135
135
 
136
- function handler(bundles) {
136
+ function handler(bundles, opts) {
137
137
  const trafficByUrl = trafficAcquisition.handler(bundles);
138
138
  const ctrByUrlAndVendor = getCTRByUrlAndVendor(bundles);
139
139
  const siteAvgCTR = getSiteAvgCTR(bundles);
140
140
  const pagesSortedByEarnedAndOverallTraffic = sortPagesByEarnedAndOverallTraffic(
141
141
  trafficByUrl,
142
- ).slice(0, MAX_OPPORTUNITIES);
142
+ ).slice(0, opts?.maxOpportunities || DEFAULT_MAX_OPPORTUNITIES);
143
143
 
144
144
  return pagesSortedByEarnedAndOverallTraffic.map((traffic) => ({
145
145
  ...traffic,