@adobe/helix-rum-enhancer
Advanced tools
Comparing version 2.3.1 to 2.4.0
@@ -0,1 +1,10 @@ | ||
# [2.4.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.3.1...v2.4.0) (2024-03-22) | ||
### Features | ||
* track UTM query parameters ([2c237e5](https://github.com/adobe/helix-rum-enhancer/commit/2c237e5361ea2f166a0c37b1b752feda30ae9293)), closes [#137](https://github.com/adobe/helix-rum-enhancer/issues/137) | ||
* track UTM query parameters ([ed58621](https://github.com/adobe/helix-rum-enhancer/commit/ed586215611c492adb29e5a98cadca3bd140d429)) | ||
* track UTM query parameters ([d1a6552](https://github.com/adobe/helix-rum-enhancer/commit/d1a6552a9b661867c0bfde06bcd066b4a1ed9024)) | ||
## [2.3.1](https://github.com/adobe/helix-rum-enhancer/compare/v2.3.0...v2.3.1) (2024-03-11) | ||
@@ -2,0 +11,0 @@ |
{ | ||
"name": "@adobe/helix-rum-enhancer", | ||
"version": "2.3.1", | ||
"version": "2.4.0", | ||
"description": "Helix RUM Enhancer", | ||
@@ -35,3 +35,3 @@ "main": "src/index.js", | ||
"@semantic-release/git": "10.0.1", | ||
"@semantic-release/npm": "11.0.3", | ||
"@semantic-release/npm": "12.0.0", | ||
"c8": "9.1.0", | ||
@@ -38,0 +38,0 @@ "codecov": "3.8.3", |
@@ -14,3 +14,3 @@ /* | ||
const KNOWN_PROPERTIES = ['weight', 'id', 'referer', 'checkpoint', 't', 'source', 'target', 'cwv', 'CLS', 'FID', 'LCP', 'INP', 'TTFB']; | ||
const DEFAULT_TRACKING_EVENTS = ['click', 'cwv', 'form', 'enterleave', 'viewblock', 'viewmedia', 'loadresource']; | ||
const DEFAULT_TRACKING_EVENTS = ['click', 'cwv', 'form', 'enterleave', 'viewblock', 'viewmedia', 'loadresource', 'utm']; | ||
const SESSION_STORAGE_KEY = 'aem-rum'; | ||
@@ -228,2 +228,10 @@ const { sampleRUM, queue, isSelected } = window.hlx.rum; | ||
function addUTMParametersTracking() { | ||
const usp = new URLSearchParams(window.location.search); | ||
[...usp.entries()] | ||
.filter(([key]) => key.startsWith('utm_')) | ||
.filter(([key]) => key !== 'utm_id'); | ||
.forEach(([source, target]) => sampleRUM('utm', { source, target })); | ||
} | ||
function addFormTracking(parent) { | ||
@@ -259,2 +267,3 @@ activateBlocksMutationObserver(); | ||
loadresource: () => addLoadResourceTracking(), | ||
utm: () => addUTMParametersTracking(), | ||
viewblock: () => addViewBlockTracking(window.document.body), | ||
@@ -261,0 +270,0 @@ viewmedia: () => addViewMediaTracking(window.document.body), |
45564
318