From 8f569facd42f3f973e774fc56d7b356720d19092 Mon Sep 17 00:00:00 2001 From: adobe-bot <30273922+adobe-bot@users.noreply.github.com> Date: Thu, 22 Aug 2024 12:45:04 -0700 Subject: [PATCH] fix(lib): update scripts/aem.js to aem.js@2.5.2 (#391) Test URL: https://update-lib-aem-patch-2-5-2--aem-boilerplate--adobe.hlx.live/ Release Notes: https://github.com/adobe/aem-lib/releases/tag/v2.5.2 Co-authored-by: semantic-release-bot --- scripts/aem.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/aem.js b/scripts/aem.js index 669a1a773..cc7e33d1f 100644 --- a/scripts/aem.js +++ b/scripts/aem.js @@ -18,7 +18,10 @@ function sampleRUM(checkpoint, data) { window.hlx = window.hlx || {}; sampleRUM.enhance = () => {}; if (!window.hlx.rum) { - const weight = new URLSearchParams(window.location.search).get('rum') === 'on' ? 1 : 100; + const weight = (window.SAMPLE_PAGEVIEWS_AT_RATE === 'high' && 10) + || (window.SAMPLE_PAGEVIEWS_AT_RATE === 'low' && 1000) + || (new URLSearchParams(window.location.search).get('rum') === 'on' && 1) + || 100; const id = Math.random().toString(36).slice(-4); const isSelected = Math.random() * weight < 1; // eslint-disable-next-line object-curly-newline, max-len