@adobe/spacecat-shared-rum-api-client 2.44.0 → 2.45.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 +12 -0
- package/package.json +1 -1
- package/src/client.js +2 -0
- package/src/common/rum-bundler-client.js +3 -1
- package/src/common/traffic.js +71 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [@adobe/spacecat-shared-rum-api-client-v2.45.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.44.1...@adobe/spacecat-shared-rum-api-client-v2.45.0) (2026-09-03)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **rum-api-client:** attribute paid vendor/channel from click-id when referrer is stripped ([#1913](https://github.com/adobe/spacecat-shared/issues/1913)) ([bd24a95](https://github.com/adobe/spacecat-shared/commit/bd24a957f75dac45e6f4481b144cc33fe474eed6))
|
|
6
|
+
|
|
7
|
+
## [@adobe/spacecat-shared-rum-api-client-v2.44.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.44.0...@adobe/spacecat-shared-rum-api-client-v2.44.1) (2026-07-24)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* add domain and summary to RUM bundle failure logs (rum-api-client) ([#1841](https://github.com/adobe/spacecat-shared/issues/1841)) ([d70bfa5](https://github.com/adobe/spacecat-shared/commit/d70bfa584d035f5234b5abb276c842af10848a46))
|
|
12
|
+
|
|
1
13
|
## [@adobe/spacecat-shared-rum-api-client-v2.44.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.43.1...@adobe/spacecat-shared-rum-api-client-v2.44.0) (2026-06-26)
|
|
2
14
|
|
|
3
15
|
### Features
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -140,6 +140,7 @@ export default class RUMAPIClient {
|
|
|
140
140
|
...opts,
|
|
141
141
|
domainkey,
|
|
142
142
|
checkpoints,
|
|
143
|
+
queryType: query,
|
|
143
144
|
}, this.log);
|
|
144
145
|
|
|
145
146
|
this.log.debug(`Query "${query}" fetched ${bundles.length} bundles`); // maybe even remove?
|
|
@@ -175,6 +176,7 @@ export default class RUMAPIClient {
|
|
|
175
176
|
...opts,
|
|
176
177
|
domainkey,
|
|
177
178
|
checkpoints: [...allCheckpoints],
|
|
179
|
+
queryType: queries.join(','),
|
|
178
180
|
}, this.log);
|
|
179
181
|
|
|
180
182
|
const results = {};
|
|
@@ -262,6 +262,7 @@ async function fetchBundles(opts, log) {
|
|
|
262
262
|
filterBotTraffic = true,
|
|
263
263
|
startTime,
|
|
264
264
|
endTime,
|
|
265
|
+
queryType,
|
|
265
266
|
} = opts;
|
|
266
267
|
|
|
267
268
|
if (!hasText(domain) || !hasText(domainkey)) {
|
|
@@ -290,7 +291,7 @@ async function fetchBundles(opts, log) {
|
|
|
290
291
|
return response.json();
|
|
291
292
|
} else {
|
|
292
293
|
const failedUrl = response.url || chunk[index];
|
|
293
|
-
log.warn(`Skipping response at index ${index}: status ${response.status} - url: ${sanitizeURL(failedUrl)}`);
|
|
294
|
+
log.warn(`Skipping response at index ${index}: status ${response.status} for domain: ${domain} - url: ${sanitizeURL(failedUrl)}`);
|
|
294
295
|
failedUrls.push(failedUrl);
|
|
295
296
|
return null;
|
|
296
297
|
}
|
|
@@ -316,6 +317,7 @@ async function fetchBundles(opts, log) {
|
|
|
316
317
|
|
|
317
318
|
// Add failedUrls to opts object for access by callers
|
|
318
319
|
if (failedUrls.length > 0) {
|
|
320
|
+
log.warn(`[RUM] ${failedUrls.length}/${urls.length} bundle requests failed for domain: ${domain}${queryType ? ` (query: ${queryType})` : ''}`);
|
|
319
321
|
// eslint-disable-next-line no-param-reassign
|
|
320
322
|
opts.failedUrls = failedUrls;
|
|
321
323
|
}
|
package/src/common/traffic.js
CHANGED
|
@@ -129,6 +129,26 @@ const vendorClassifications = [
|
|
|
129
129
|
const paidTrackingParams = ['paid'];
|
|
130
130
|
const emailTrackingParams = ['email'];
|
|
131
131
|
|
|
132
|
+
// Ad-platform click-id parameters captured by the RUM `paid` checkpoint.
|
|
133
|
+
// These identify the ad platform even when the HTTP referrer is stripped and the
|
|
134
|
+
// utm_source is an opaque in-house campaign code. `category` is set only for
|
|
135
|
+
// channel-unambiguous (social-network) click-ids; search/display click-ids
|
|
136
|
+
// (gclid/dclid/msclkid) attribute the vendor but leave the channel to the RULES.
|
|
137
|
+
const clickIdClassifications = {
|
|
138
|
+
li_fat_id: { vendor: 'linkedin', category: 'social' },
|
|
139
|
+
fbclid: { vendor: 'facebook', category: 'social' },
|
|
140
|
+
ttclid: { vendor: 'tiktok', category: 'social' },
|
|
141
|
+
twclid: { vendor: 'x', category: 'social' },
|
|
142
|
+
epik: { vendor: 'pinterest', category: 'social' },
|
|
143
|
+
sccid: { vendor: 'snapchat', category: 'social' },
|
|
144
|
+
gclid: { vendor: 'google' },
|
|
145
|
+
gbraid: { vendor: 'google' },
|
|
146
|
+
wbraid: { vendor: 'google' },
|
|
147
|
+
gclsrc: { vendor: 'google' },
|
|
148
|
+
dclid: { vendor: 'google' },
|
|
149
|
+
msclkid: { vendor: 'bing' },
|
|
150
|
+
};
|
|
151
|
+
|
|
132
152
|
/*
|
|
133
153
|
* --------- HELPERS ----------------
|
|
134
154
|
*/
|
|
@@ -340,7 +360,35 @@ export function classifyVendor(referrer, utmSource, utmMedium) {
|
|
|
340
360
|
return result ? result.result : '';
|
|
341
361
|
}
|
|
342
362
|
|
|
343
|
-
|
|
363
|
+
/**
|
|
364
|
+
* Attributes a paid ad platform from the RUM `paid` checkpoint's tracking source
|
|
365
|
+
* (e.g. 'linkedin', 'doubleclick') and target (the click-id, e.g. 'li_fat_id').
|
|
366
|
+
* This is the only reliable signal when the referrer is stripped and the utm_source
|
|
367
|
+
* is an opaque in-house campaign code.
|
|
368
|
+
* @param {string} trackingSource - The `paid` checkpoint source (the ad platform).
|
|
369
|
+
* @param {string} trackingTarget - The `paid` checkpoint target (the click-id param).
|
|
370
|
+
* @returns {{vendor?: string, category?: string}} Vendor and, for social-network
|
|
371
|
+
* click-ids, the corrected category; empty object when nothing is identifiable.
|
|
372
|
+
*/
|
|
373
|
+
export function classifyPaidClickId(trackingSource, trackingTarget) {
|
|
374
|
+
const clickId = (trackingTarget || '').toLowerCase();
|
|
375
|
+
if (clickIdClassifications[clickId]) {
|
|
376
|
+
return clickIdClassifications[clickId];
|
|
377
|
+
}
|
|
378
|
+
// Fall back to a named tracking source (e.g. 'linkedin', 'doubleclick' -> google).
|
|
379
|
+
const vendor = classifyVendor(trackingSource || '', '', '');
|
|
380
|
+
return vendor ? { vendor } : {};
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
export function classifyTrafficSource(
|
|
384
|
+
url,
|
|
385
|
+
referrer,
|
|
386
|
+
utmSource,
|
|
387
|
+
utmMedium,
|
|
388
|
+
trackingEvent,
|
|
389
|
+
trackingSource = '',
|
|
390
|
+
trackingTarget = '',
|
|
391
|
+
) {
|
|
344
392
|
const secondLevelDomain = getSecondLevelDomain(url);
|
|
345
393
|
const rules = RULES(secondLevelDomain);
|
|
346
394
|
|
|
@@ -366,6 +414,19 @@ export function classifyTrafficSource(url, referrer, utmSource, utmMedium, track
|
|
|
366
414
|
category = overridden.category;
|
|
367
415
|
vendor = overridden.vendor;
|
|
368
416
|
|
|
417
|
+
// Paid click-id fallback: when the referrer/UTM don't identify the platform, the
|
|
418
|
+
// `paid` checkpoint's source/target (click-id) still do. Attribute the vendor and,
|
|
419
|
+
// for social-network click-ids, correct the `display` catch-all channel.
|
|
420
|
+
if (type === 'paid' && !vendor) {
|
|
421
|
+
const paid = classifyPaidClickId(trackingSource, trackingTarget);
|
|
422
|
+
if (paid.vendor) {
|
|
423
|
+
vendor = paid.vendor;
|
|
424
|
+
if (paid.category && category === 'display') {
|
|
425
|
+
category = paid.category;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
369
430
|
// validate vendor against allowed vendors for this type/category
|
|
370
431
|
const validatedVendor = validateVendor(type, category, vendor);
|
|
371
432
|
|
|
@@ -402,6 +463,14 @@ export function classifyTraffic(bundle) {
|
|
|
402
463
|
weight,
|
|
403
464
|
trackingSource,
|
|
404
465
|
trackingTarget,
|
|
405
|
-
...classifyTrafficSource(
|
|
466
|
+
...classifyTrafficSource(
|
|
467
|
+
url,
|
|
468
|
+
referrer,
|
|
469
|
+
source,
|
|
470
|
+
utmMedium,
|
|
471
|
+
tracking,
|
|
472
|
+
trackingSource,
|
|
473
|
+
trackingTarget,
|
|
474
|
+
),
|
|
406
475
|
};
|
|
407
476
|
}
|