@adobe/helix-rum-enhancer 2.3.1 → 2.4.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 CHANGED
@@ -1,3 +1,12 @@
1
+ # [2.4.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.3.1...v2.4.0) (2024-03-22)
2
+
3
+
4
+ ### Features
5
+
6
+ * 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)
7
+ * track UTM query parameters ([ed58621](https://github.com/adobe/helix-rum-enhancer/commit/ed586215611c492adb29e5a98cadca3bd140d429))
8
+ * track UTM query parameters ([d1a6552](https://github.com/adobe/helix-rum-enhancer/commit/d1a6552a9b661867c0bfde06bcd066b4a1ed9024))
9
+
1
10
  ## [2.3.1](https://github.com/adobe/helix-rum-enhancer/compare/v2.3.0...v2.3.1) (2024-03-11)
2
11
 
3
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "2.3.1",
3
+ "version": "2.4.0",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -32,7 +32,7 @@
32
32
  "@adobe/eslint-config-helix": "2.0.6",
33
33
  "@semantic-release/changelog": "6.0.3",
34
34
  "@semantic-release/git": "10.0.1",
35
- "@semantic-release/npm": "11.0.3",
35
+ "@semantic-release/npm": "12.0.0",
36
36
  "c8": "9.1.0",
37
37
  "codecov": "3.8.3",
38
38
  "eslint": "8.57.0",
package/src/index.js CHANGED
@@ -11,7 +11,7 @@
11
11
  */
12
12
  /* eslint-env browser */
13
13
  const KNOWN_PROPERTIES = ['weight', 'id', 'referer', 'checkpoint', 't', 'source', 'target', 'cwv', 'CLS', 'FID', 'LCP', 'INP', 'TTFB'];
14
- const DEFAULT_TRACKING_EVENTS = ['click', 'cwv', 'form', 'enterleave', 'viewblock', 'viewmedia', 'loadresource'];
14
+ const DEFAULT_TRACKING_EVENTS = ['click', 'cwv', 'form', 'enterleave', 'viewblock', 'viewmedia', 'loadresource', 'utm'];
15
15
  const SESSION_STORAGE_KEY = 'aem-rum';
16
16
  const { sampleRUM, queue, isSelected } = window.hlx.rum;
17
17
 
@@ -224,6 +224,14 @@ function addViewMediaTracking(parent) {
224
224
  }
225
225
  }
226
226
 
227
+ function addUTMParametersTracking() {
228
+ const usp = new URLSearchParams(window.location.search);
229
+ [...usp.entries()]
230
+ .filter(([key]) => key.startsWith('utm_'))
231
+ .filter(([key]) => key !== 'utm_id');
232
+ .forEach(([source, target]) => sampleRUM('utm', { source, target }));
233
+ }
234
+
227
235
  function addFormTracking(parent) {
228
236
  activateBlocksMutationObserver();
229
237
  parent.querySelectorAll('form').forEach((form) => {
@@ -254,6 +262,7 @@ function addTrackingFromConfig() {
254
262
  form: () => addFormTracking(window.document.body),
255
263
  enterleave: () => addEnterLeaveTracking(),
256
264
  loadresource: () => addLoadResourceTracking(),
265
+ utm: () => addUTMParametersTracking(),
257
266
  viewblock: () => addViewBlockTracking(window.document.body),
258
267
  viewmedia: () => addViewMediaTracking(window.document.body),
259
268
  };