From 7288bd19ef854af626ddf7e10c337bc184ef49d2 Mon Sep 17 00:00:00 2001 From: Andrei Tuicu Date: Mon, 8 Apr 2024 11:04:55 +0200 Subject: [PATCH 1/3] Load Launch Script in Head --- aemeds/scripts/delayed.js | 2 +- head.html | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/aemeds/scripts/delayed.js b/aemeds/scripts/delayed.js index 2c41e226..facb4701 100644 --- a/aemeds/scripts/delayed.js +++ b/aemeds/scripts/delayed.js @@ -32,4 +32,4 @@ async function loadAdobeDTM() { } } -loadAdobeDTM(); +// loadAdobeDTM(); diff --git a/head.html b/head.html index b775cca9..ae86e66a 100644 --- a/head.html +++ b/head.html @@ -1,5 +1,7 @@ + + From d55ceabb2c241d618b920669cd64da2e7632176a Mon Sep 17 00:00:00 2001 From: Andrei Tuicu Date: Sun, 14 Apr 2024 21:36:21 +0200 Subject: [PATCH 2/3] Load Launch Script in Head --- aemeds/scripts/delayed.js | 32 +------------------------------- head.html | 4 ++-- 2 files changed, 3 insertions(+), 33 deletions(-) diff --git a/aemeds/scripts/delayed.js b/aemeds/scripts/delayed.js index facb4701..2192d287 100644 --- a/aemeds/scripts/delayed.js +++ b/aemeds/scripts/delayed.js @@ -2,34 +2,4 @@ import { loadScript, sampleRUM } from './aem.js'; // Core Web Vitals RUM collection -sampleRUM('cwv'); -// add more delayed functionality here -async function loadAdobeDTM() { - await loadScript(`${window.hlx.codeBasePath}/scripts/jquery-3.7.1.min.js`); - const prod = 'https://assets.adobedtm.com/a441b904b50e/7a4facbbcffb/launch-039be8795dc8.min.js'; - const stage = 'https://assets.adobedtm.com/a441b904b50e/7a4facbbcffb/launch-a2ae4c3b0523-staging.min.js'; - - const searchParams = new URLSearchParams(window.location.search); - const env = searchParams.get('launch'); - if (env === 'prod') { - loadScript(prod, { async: '' }); - return; - } - - if (env === 'stage') { - loadScript(stage, { async: '' }); - return; - } - - const { host } = window.location; - if (host === 'servicenow.com' || host === 'www.servicenow.com') { - loadScript(prod, { async: '' }); - } else { - if (searchParams.get('disableLaunch') === 'true') { - return; - } - loadScript(stage, { async: '' }); - } -} - -// loadAdobeDTM(); +sampleRUM('cwv'); \ No newline at end of file diff --git a/head.html b/head.html index ae86e66a..344f04d9 100644 --- a/head.html +++ b/head.html @@ -2,6 +2,6 @@ - + - + \ No newline at end of file From 5129f2b90f4e625c34d8ba56037715060c826fd2 Mon Sep 17 00:00:00 2001 From: Andrei Tuicu Date: Sun, 14 Apr 2024 21:38:24 +0200 Subject: [PATCH 3/3] Load Launch Script in Head --- aemeds/scripts/delayed.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aemeds/scripts/delayed.js b/aemeds/scripts/delayed.js index 2192d287..5903af24 100644 --- a/aemeds/scripts/delayed.js +++ b/aemeds/scripts/delayed.js @@ -1,5 +1,5 @@ // eslint-disable-next-line import/no-cycle -import { loadScript, sampleRUM } from './aem.js'; +import { sampleRUM } from './aem.js'; // Core Web Vitals RUM collection -sampleRUM('cwv'); \ No newline at end of file +sampleRUM('cwv');