@adobe/helix-rum-enhancer
Advanced tools
Comparing version 2.10.0 to 2.11.0
@@ -0,1 +1,8 @@ | ||
# [2.11.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.10.0...v2.11.0) (2024-05-31) | ||
### Features | ||
* **index:** report ad clicks and email clicks ([f5b0779](https://github.com/adobe/helix-rum-enhancer/commit/f5b0779e4286962d881b69411efb8045660ff5de)) | ||
# [2.10.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.9.0...v2.10.0) (2024-05-31) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "@adobe/helix-rum-enhancer", | ||
"version": "2.10.0", | ||
"version": "2.11.0", | ||
"description": "Helix RUM Enhancer", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -24,2 +24,4 @@ /* | ||
onetrust: [543, 770, 1136], | ||
ads: [1339], | ||
email: [1339], | ||
}; | ||
@@ -101,2 +103,4 @@ | ||
fflags.enabled('onetrust', () => DEFAULT_TRACKING_EVENTS.push('consent')); | ||
fflags.enabled('ads', () => DEFAULT_TRACKING_EVENTS.push('paid')); | ||
fflags.enabled('email', () => DEFAULT_TRACKING_EVENTS.push('email')); | ||
return DEFAULT_TRACKING_EVENTS; | ||
@@ -289,2 +293,31 @@ } | ||
function addAdsParametersTracking() { | ||
const networks = { | ||
google: /gclid|gclsrc|wbraid|gbraid/, | ||
doubleclick: /dclid/, | ||
microsoft: /msclkid/, | ||
facebook: /fb(cl|ad_|pxl_)id/, | ||
twitter: /tw(clid|src|term)/, | ||
linkedin: /li_fat_id/, | ||
pinterest: /epik/, | ||
tiktok: /ttclid/, | ||
}; | ||
const params = Array.from(new URLSearchParams(window.location.search).keys()); | ||
Object.entries(networks).forEach(([network, regex]) => { | ||
params.filter((param) => regex.test(param)).forEach((param) => sampleRUM('paid', { source: network, target: param })); | ||
}); | ||
} | ||
function addEmailParameterTracking() { | ||
const networks = { | ||
mailchimp: /mc_(c|e)id/, | ||
marketo: /mkt_tok/, | ||
}; | ||
const params = Array.from(new URLSearchParams(window.location.search).keys()); | ||
Object.entries(networks).forEach(([network, regex]) => { | ||
params.filter((param) => regex.test(param)).forEach((param) => sampleRUM('email', { source: network, target: param })); | ||
}); | ||
} | ||
function addFormTracking(parent) { | ||
@@ -359,2 +392,4 @@ activateBlocksMutationObserver(); | ||
consent: () => addCookieConsentTracking(), | ||
paid: () => addAdsParametersTracking(), | ||
email: () => addEmailParameterTracking(), | ||
}; | ||
@@ -361,0 +396,0 @@ |
53574
435