@adobe/spacecat-shared-rum-api-client 2.7.1 → 2.7.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
+ # [@adobe/spacecat-shared-rum-api-client-v2.7.3](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.7.2...@adobe/spacecat-shared-rum-api-client-v2.7.3) (2024-08-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** update external fixes ([#320](https://github.com/adobe/spacecat-shared/issues/320)) ([c75b743](https://github.com/adobe/spacecat-shared/commit/c75b7432e0add9b261ddc7999fe80b20442a0dd7))
7
+
8
+ # [@adobe/spacecat-shared-rum-api-client-v2.7.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.7.1...@adobe/spacecat-shared-rum-api-client-v2.7.2) (2024-08-09)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * use actual number of samples in p-value calculations instead of weighted calculations ([#317](https://github.com/adobe/spacecat-shared/issues/317)) ([6b15543](https://github.com/adobe/spacecat-shared/commit/6b155437933a1ef74559afdfb93f5daaad77609f))
14
+
1
15
  # [@adobe/spacecat-shared-rum-api-client-v2.7.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.7.0...@adobe/spacecat-shared-rum-api-client-v2.7.1) (2024-08-09)
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.7.1",
3
+ "version": "2.7.3",
4
4
  "description": "Shared modules of the Spacecat Services - Rum API client",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -35,7 +35,7 @@
35
35
  "@adobe/helix-shared-wrap": "2.0.2",
36
36
  "@adobe/helix-universal": "5.0.5",
37
37
  "@adobe/spacecat-shared-utils": "1.4.0",
38
- "aws4": "1.13.0",
38
+ "aws4": "1.13.1",
39
39
  "d3-array": "3.2.4",
40
40
  "urijs": "^1.19.11"
41
41
  },
@@ -38,6 +38,7 @@ function getOrCreateVariantObject(variants, variantName) {
38
38
  variantObject = {
39
39
  name: variantName,
40
40
  views: 0,
41
+ samples: 0,
41
42
  click: {},
42
43
  convert: {},
43
44
  formsubmit: {},
@@ -82,9 +83,13 @@ function calculateMetrics(bundle) {
82
83
  if (METRIC_CHECKPOINTS.includes(event.checkpoint)) {
83
84
  const { source, checkpoint } = event;
84
85
  if (!metrics[checkpoint][source]) {
85
- metrics[checkpoint][source] = bundle.weight;
86
+ metrics[checkpoint][source] = {
87
+ value: bundle.weight,
88
+ samples: 1,
89
+ };
86
90
  } else {
87
- metrics[checkpoint][source] += bundle.weight;
91
+ metrics[checkpoint][source].value += bundle.weight;
92
+ metrics[checkpoint][source].samples += 1;
88
93
  }
89
94
  }
90
95
  }
@@ -112,15 +117,20 @@ function handler(bundles) {
112
117
  const variantObject = getOrCreateVariantObject(experimentObject.variants, variantName);
113
118
  updateInferredStartAndEndDate(experimentObject, time);
114
119
  variantObject.views += weight;
120
+ variantObject.samples += 1;
115
121
  // combine metrics and variantObject, considering the interaction events
116
122
  // only once during the session
117
123
  for (const checkpoint of METRIC_CHECKPOINTS) {
118
124
  // eslint-disable-next-line no-restricted-syntax
119
125
  for (const source in metrics?.[checkpoint]) {
120
126
  if (!variantObject[checkpoint][source]) {
121
- variantObject[checkpoint][source] = weight;
127
+ variantObject[checkpoint][source] = {
128
+ value: weight,
129
+ samples: 1,
130
+ };
122
131
  } else {
123
- variantObject[checkpoint][source] += weight;
132
+ variantObject[checkpoint][source].value += weight;
133
+ variantObject[checkpoint][source].samples += 1;
124
134
  }
125
135
  }
126
136
  }
@@ -128,9 +138,13 @@ function handler(bundles) {
128
138
  for (const checkpoint of Object.keys(metrics)) {
129
139
  if (Object.keys(metrics[checkpoint]).length > 0) {
130
140
  if (!variantObject[checkpoint]['*']) {
131
- variantObject[checkpoint]['*'] = weight;
141
+ variantObject[checkpoint]['*'] = {
142
+ value: weight,
143
+ samples: 1,
144
+ };
132
145
  } else {
133
- variantObject[checkpoint]['*'] += weight;
146
+ variantObject[checkpoint]['*'].value += weight;
147
+ variantObject[checkpoint]['*'].samples += 1;
134
148
  }
135
149
  }
136
150
  }