@adobe/spacecat-shared-rum-api-client 2.44.1 → 2.45.1

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,15 @@
1
+ ## [@adobe/spacecat-shared-rum-api-client-v2.45.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.45.0...@adobe/spacecat-shared-rum-api-client-v2.45.1) (2026-10-08)
2
+
3
+ ### Bug Fixes
4
+
5
+ * **deps:** update dependency @adobe/rum-distiller to v1.23.3 ([#1971](https://github.com/adobe/spacecat-shared/issues/1971)) ([648254e](https://github.com/adobe/spacecat-shared/commit/648254efa2ff6134e099f5de78589d4a671671d4))
6
+
7
+ ## [@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)
8
+
9
+ ### Features
10
+
11
+ * **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))
12
+
1
13
  ## [@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)
2
14
 
3
15
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-rum-api-client",
3
- "version": "2.44.1",
3
+ "version": "2.45.1",
4
4
  "description": "Shared modules of the Spacecat Services - Rum API client",
5
5
  "type": "module",
6
6
  "engines": {
@@ -35,10 +35,10 @@
35
35
  "access": "public"
36
36
  },
37
37
  "dependencies": {
38
- "@adobe/fetch": "4.3.0",
38
+ "@adobe/fetch": "4.3.1",
39
39
  "@adobe/helix-shared-wrap": "2.0.2",
40
- "@adobe/helix-universal": "5.4.2",
41
- "@adobe/rum-distiller": "1.23.0",
40
+ "@adobe/helix-universal": "5.4.3",
41
+ "@adobe/rum-distiller": "1.23.3",
42
42
  "@adobe/spacecat-shared-utils": "1.81.1",
43
43
  "aws4": "1.13.2",
44
44
  "urijs": "1.19.11"
@@ -46,8 +46,8 @@
46
46
  "devDependencies": {
47
47
  "chai": "6.2.2",
48
48
  "chai-as-promised": "8.0.2",
49
- "nock": "14.0.15",
50
- "sinon": "22.0.0",
49
+ "nock": "14.0.17",
50
+ "sinon": "22.1.0",
51
51
  "sinon-chai": "4.0.1",
52
52
  "typescript": "6.0.3"
53
53
  }
@@ -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
- export function classifyTrafficSource(url, referrer, utmSource, utmMedium, trackingEvent) {
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(url, referrer, source, utmMedium, tracking),
466
+ ...classifyTrafficSource(
467
+ url,
468
+ referrer,
469
+ source,
470
+ utmMedium,
471
+ tracking,
472
+ trackingSource,
473
+ trackingTarget,
474
+ ),
406
475
  };
407
476
  }