Skip to content

Commit

Permalink
Update scripts.js
Browse files Browse the repository at this point in the history
  • Loading branch information
fnhipster committed Nov 11, 2024
1 parent 512c106 commit 87e9b4d
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,17 @@ async function loadEager(doc) {
document.documentElement.lang = 'en';
decorateTemplateAndTheme();

// Instrument experimentation plugin
if (getMetadata('experiment')
|| Object.keys(getAllMetadata('campaign')).length
|| Object.keys(getAllMetadata('audience')).length) {
// eslint-disable-next-line import/no-relative-packages
const { loadEager: runEager } = await import('../plugins/experimentation/src/index.js');
await runEager(document, { audiences: AUDIENCES }, pluginContext);
}

await initializeDropins();

window.adobeDataLayer = window.adobeDataLayer || [];

let pageType = 'CMS';
Expand Down Expand Up @@ -359,16 +370,6 @@ export function getConsent(topic) {
}

async function loadPage() {
// Instrument experimentation plugin
if (getMetadata('experiment')
|| Object.keys(getAllMetadata('campaign')).length
|| Object.keys(getAllMetadata('audience')).length) {
// eslint-disable-next-line import/no-relative-packages
const { loadEager: runEager } = await import('../plugins/experimentation/src/index.js');
await runEager(document, { audiences: AUDIENCES }, pluginContext);
}

await initializeDropins();
await loadEager(document);
await loadLazy(document);
loadDelayed();
Expand Down

0 comments on commit 87e9b4d

Please sign in to comment.