Skip to content

Commit

Permalink
feat: introduce adobe core martech stack
Browse files Browse the repository at this point in the history
  • Loading branch information
ramboz committed Mar 21, 2024
1 parent f848cc5 commit f8fc49e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 2 additions & 0 deletions scripts/adobe-martech/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ export async function updateUserConsent(isConsented) {
}

export async function initMartech(config = {}) {
// eslint-disable-next-line no-console
console.assert(config.datastreamId || config.edgeConfigId, 'Please set your "datastreamId" for the WebSDK config.');
// eslint-disable-next-line no-console
console.assert(config.orgId, 'Please set your "orgId" for the WebSDK config.');
initAlloyQueue();
initDatalayer();
Expand Down
15 changes: 6 additions & 9 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
const LCP_BLOCKS = ['carousel']; // add your LCP blocks to the list
window.hlx.RUM_GENERATION = 'project-1'; // add your RUM generation information here

const martechLoadedPromise = await initMartech({
const martechLoadedPromise = initMartech({
datastreamId: 'cc68fdd3-4db1-432c-adce-288917ddf108',
orgId: '908936ED5D35CC220A495CD4@AdobeOrg',
defaultConsent: 'in', // 'pending',
Expand Down Expand Up @@ -189,14 +189,11 @@ async function loadEager(doc) {

const main = doc.querySelector('main');
if (main) {
await martechLoadedPromise;
await new Promise((res) => {
window.requestAnimationFrame(() => decorateMain(main));
window.requestAnimationFrame(async () => {
await waitForLCP(LCP_BLOCKS);
res();
});
});
decorateMain(main);
await Promise.all([
martechLoadedPromise,
waitForLCP(LCP_BLOCKS),
]);
}
}

Expand Down

0 comments on commit f8fc49e

Please sign in to comment.