From 46a642e4f2ecfcf65c0478a2928b38e92f92b5a5 Mon Sep 17 00:00:00 2001 From: Robert Bogos Date: Tue, 11 Jun 2024 15:07:18 +0300 Subject: [PATCH 1/3] extended non prod hostname check --- scripts/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/utils.js b/scripts/utils.js index e070638..25c4de6 100644 --- a/scripts/utils.js +++ b/scripts/utils.js @@ -4,7 +4,7 @@ export const [setLibs, getLibs] = (() => { (prodLibs, location) => { libs = (() => { const { hostname, search } = location || window.location; - if (!(hostname.includes('.hlx.') || hostname.includes('local'))) return prodLibs; + if (!['.hlx.', '.stage.', 'local'].some(i => hostname.includes(i))) return prodLibs; const branch = new URLSearchParams(search).get('milolibs') || 'main'; if (branch === 'local') return 'http://localhost:6456/libs'; return branch.includes('--') ? `https://${branch}.hlx.live/libs` : `https://${branch}--milo--adobecom.hlx.live/libs`; From d4b407cfb43e47c2ce0bcacb3c3967dea869059e Mon Sep 17 00:00:00 2001 From: Robert Bogos Date: Tue, 11 Jun 2024 15:18:26 +0300 Subject: [PATCH 2/3] eslint fix --- scripts/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/utils.js b/scripts/utils.js index 25c4de6..bd9f037 100644 --- a/scripts/utils.js +++ b/scripts/utils.js @@ -4,7 +4,7 @@ export const [setLibs, getLibs] = (() => { (prodLibs, location) => { libs = (() => { const { hostname, search } = location || window.location; - if (!['.hlx.', '.stage.', 'local'].some(i => hostname.includes(i))) return prodLibs; + if (!['.hlx.', '.stage.', 'local'].some((i) => hostname.includes(i))) return prodLibs; const branch = new URLSearchParams(search).get('milolibs') || 'main'; if (branch === 'local') return 'http://localhost:6456/libs'; return branch.includes('--') ? `https://${branch}.hlx.live/libs` : `https://${branch}--milo--adobecom.hlx.live/libs`; From c8def9e14b85055defe3221e3c3012f2f1f53f5d Mon Sep 17 00:00:00 2001 From: Okan Sahin Date: Thu, 13 Jun 2024 11:26:02 +0200 Subject: [PATCH 3/3] Increase 404 tracking --- scripts/scripts.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/scripts.js b/scripts/scripts.js index 3c06f70..533c05d 100644 --- a/scripts/scripts.js +++ b/scripts/scripts.js @@ -168,7 +168,8 @@ const miloLibs = setLibs(LIBS); }()); (async function loadPage() { - const { loadArea, loadLana, setConfig, createTag } = await import(`${miloLibs}/utils/utils.js`); + const { loadArea, loadLana, setConfig, createTag, getMetadata } = await import(`${miloLibs}/utils/utils.js`); + if (getMetadata('template') === '404') window.SAMPLE_PAGEVIEWS_AT_RATE = 'high'; const metaCta = document.querySelector('meta[name="chat-cta"]'); if (metaCta && !document.querySelector('.chat-cta')) { const isMetaCtaDisabled = metaCta?.content === 'off';