Skip to content

Commit

Permalink
make some analytics fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Lakshmishri committed Nov 8, 2024
1 parent 2c8465b commit c934226
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions scripts/delayed.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
import { loadScript } from './aem.js';


Check failure on line 3 in scripts/delayed.js

View workflow job for this annotation

GitHub Actions / build

More than 1 blank line not allowed
function injectScript(src, crossOrigin = '') {
window.scriptsLoaded = window.scriptsLoaded || [];

if (window.scriptsLoaded.indexOf(src)) {
const head = document.querySelector('head');
const script = document.createElement('script');

script.src = src;
script.setAttribute('async', 'true');
if (['anonymous', 'use-credentials'].includes(crossOrigin)) {
script.crossOrigin = crossOrigin;
}
head.append(script);
window.scriptsLoaded.push(src);
}
}

function loadLaunch() {
window.adobeDataLayer = window.adobeDataLayer || [];
injectScript('https://assets.adobedtm.com/53c8e773d591/d826b4085ef5/launch-268ad0976d20.min.js');
}

// OneTrust Cookies Consent Notice
if (!window.location.pathname.includes('srcdoc')
&& !['localhost', 'hlx.page', 'hlx.live', 'aem.page', 'aem.live'].some((url) => window.location.host.includes(url))) {
Expand Down Expand Up @@ -31,31 +54,8 @@ if (!window.location.pathname.includes('srcdoc')
// reloading the page only when the active group has changed
if (!isSameGroups(currentOnetrustActiveGroups, window.OnetrustActiveGroups)) {
window.location.reload();
loadLaunch();
}
});
};
}

function injectScript(src, crossOrigin = '') {
window.scriptsLoaded = window.scriptsLoaded || [];

if (window.scriptsLoaded.indexOf(src)) {
const head = document.querySelector('head');
const script = document.createElement('script');

script.src = src;
script.setAttribute('async', 'true');
if (['anonymous', 'use-credentials'].includes(crossOrigin)) {
script.crossOrigin = crossOrigin;
}
head.append(script);
window.scriptsLoaded.push(src);
}
}

function loadLaunch() {
window.adobeDataLayer = window.adobeDataLayer || [];
injectScript('https://assets.adobedtm.com/53c8e773d591/d826b4085ef5/launch-268ad0976d20.min.js');
}

loadLaunch();

0 comments on commit c934226

Please sign in to comment.