@adobe/spacecat-shared-rum-api-client 2.7.1 → 2.7.2
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/experiment.js +20 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [@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)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* 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))
|
|
7
|
+
|
|
1
8
|
# [@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
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -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] =
|
|
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] =
|
|
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]['*'] =
|
|
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
|
}
|