Skip to content

Commit

Permalink
experimentation must load before dropins initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
fnhipster committed Nov 11, 2024
1 parent ec6aea5 commit 512c106
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 512c106

Please sign in to comment.