@adobe/spacecat-shared-rum-api-client 2.44.1 → 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 +6 -0
- package/package.json +1 -1
- package/src/common/traffic.js +71 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
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
|
+
|
|
1
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)
|
|
2
8
|
|
|
3
9
|
### Bug Fixes
|
package/package.json
CHANGED
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
|
}
|