diff --git a/scripts/scripts.js b/scripts/scripts.js index 6dda8ab35a..76b3831995 100644 --- a/scripts/scripts.js +++ b/scripts/scripts.js @@ -168,15 +168,6 @@ 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); - } - window.adobeDataLayer = window.adobeDataLayer || []; let pageType = 'CMS'; @@ -368,6 +359,15 @@ 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);