@adobe/spacecat-shared-rum-api-client 2.12.4 → 2.12.6
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 +14 -0
- package/package.json +2 -2
- package/src/common/rum-bundler-client.js +11 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-rum-api-client-v2.12.6](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.12.5...@adobe/spacecat-shared-rum-api-client-v2.12.6) (2024-11-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update dependency @adobe/rum-distiller to v1.11.1 ([#462](https://github.com/adobe/spacecat-shared/issues/462)) ([4fcfcd0](https://github.com/adobe/spacecat-shared/commit/4fcfcd0b78c2dceed6e2cd517cd4f54dd9c420d5)), closes [#8203](https://github.com/adobe/spacecat-shared/issues/8203)
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-rum-api-client-v2.12.5](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.12.4...@adobe/spacecat-shared-rum-api-client-v2.12.5) (2024-11-27)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* exclude bot traffic from page views and opportunities ctr calculations ([#446](https://github.com/adobe/spacecat-shared/issues/446)) ([3d06fb7](https://github.com/adobe/spacecat-shared/commit/3d06fb70b6b20343380c94cefc467f1dc6183cb7))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-rum-api-client-v2.12.4](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.12.3...@adobe/spacecat-shared-rum-api-client-v2.12.4) (2024-11-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.12.
|
|
3
|
+
"version": "2.12.6",
|
|
4
4
|
"description": "Shared modules of the Spacecat Services - Rum API client",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@adobe/helix-shared-wrap": "2.0.2",
|
|
40
40
|
"@adobe/helix-universal": "5.0.6",
|
|
41
41
|
"@adobe/spacecat-shared-utils": "1.22.4",
|
|
42
|
-
"@adobe/rum-distiller": "1.
|
|
42
|
+
"@adobe/rum-distiller": "1.11.1",
|
|
43
43
|
"aws4": "1.13.2",
|
|
44
44
|
"urijs": "^1.19.11"
|
|
45
45
|
},
|
|
@@ -22,7 +22,11 @@ const ONE_DAY = ONE_HOUR * HOURS_IN_DAY;
|
|
|
22
22
|
|
|
23
23
|
const CHUNK_SIZE = 31;
|
|
24
24
|
|
|
25
|
-
function
|
|
25
|
+
function isBotTraffic(bundle) {
|
|
26
|
+
return bundle?.userAgent?.includes('bot');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function filterEvents(checkpoints = []) {
|
|
26
30
|
return (bundle) => {
|
|
27
31
|
if (checkpoints.length > 0) {
|
|
28
32
|
const events = bundle.events.filter((event) => checkpoints.includes(event.checkpoint));
|
|
@@ -160,6 +164,7 @@ async function fetchBundles(opts = {}) {
|
|
|
160
164
|
interval = 7,
|
|
161
165
|
granularity = GRANULARITY.DAILY,
|
|
162
166
|
checkpoints = [],
|
|
167
|
+
filterBotTraffic = true,
|
|
163
168
|
} = opts;
|
|
164
169
|
|
|
165
170
|
if (!hasText(domain) || !hasText(domainkey)) {
|
|
@@ -185,7 +190,11 @@ async function fetchBundles(opts = {}) {
|
|
|
185
190
|
for (const chunk of chunks) {
|
|
186
191
|
const responses = await Promise.all(chunk.map((url) => fetch(url)));
|
|
187
192
|
const bundles = await Promise.all(responses.map((response) => response.json()));
|
|
188
|
-
result.push(...bundles.flatMap(
|
|
193
|
+
result.push(...bundles.flatMap(
|
|
194
|
+
(b) => b.rumBundles.filter(
|
|
195
|
+
(bundle) => !filterBotTraffic || !isBotTraffic(bundle),
|
|
196
|
+
).map(filterEvents(checkpoints)),
|
|
197
|
+
));
|
|
189
198
|
}
|
|
190
199
|
return mergeBundlesWithSameId(result);
|
|
191
200
|
}
|