From 0b10102751a417ed7dc76db6369487815722e99f Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 17 Oct 2024 12:37:33 +0000 Subject: [PATCH] feat(lib): update scripts/aem.js to aem.js@2.7.0 Test URL: https://update-lib-aem-minor-2-7-0--aem-boilerplate--adobe.hlx.live/ Release Notes: https://github.com/adobe/aem-lib/releases/tag/v2.7.0 --- scripts/aem.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/aem.js b/scripts/aem.js index cc7e33d1fd..715d2b52e5 100644 --- a/scripts/aem.js +++ b/scripts/aem.js @@ -80,7 +80,13 @@ function sampleRUM(checkpoint, data) { t: time, ...pingData, }); - const { href: url, origin } = new URL(`.rum/${weight}`, sampleRUM.collectBaseURL); + const urlParams = window.RUM_PARAMS + ? `?${new URLSearchParams(window.RUM_PARAMS).toString()}` + : ''; + const { href: url, origin } = new URL( + `.rum/${weight}${urlParams}`, + sampleRUM.collectBaseURL, + ); const body = origin === window.location.origin ? new Blob([rumData], { type: 'application/json' }) : rumData; @@ -108,7 +114,7 @@ function sampleRUM(checkpoint, data) { } document.dispatchEvent(new CustomEvent('rum', { detail: { checkpoint, data } })); } catch (error) { - // something went wrong + // something went awry } } @@ -684,6 +690,9 @@ async function loadSections(element) { for (let i = 0; i < sections.length; i += 1) { // eslint-disable-next-line no-await-in-loop await loadSection(sections[i]); + if (i === 0 && sampleRUM.enhance) { + sampleRUM.enhance(); + } } }