Skip to content

Commit

Permalink
Martech codeupdate (#2476)
Browse files Browse the repository at this point in the history
codeupdate

Co-authored-by: Kanda S <kandavadives@adobe.com>
  • Loading branch information
kandavadivelan and Kanda S authored Jun 14, 2024
1 parent 0cdd84a commit 40d1ced
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions libs/martech/martech.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ const getTargetPersonalization = async () => {
}, { once: true });

let manifests = [];
let propositions = [];
const response = await waitForEventOrTimeout(ALLOY_SEND_EVENT, timeout);
if (response.error) {
window.lana.log('target response time: ad blocker', { tags: 'errorType=info,module=martech' });
Expand All @@ -143,9 +144,13 @@ const getTargetPersonalization = async () => {
} else {
sendTargetResponseAnalytics(false, responseStart, timeout);
manifests = handleAlloyResponse(response.result);
propositions = response.result && response.result.propositions;
}

return manifests;
return {
targetManifests: manifests,
targetPropositions: propositions,
};
};

const getDtmLib = (env) => ({
Expand Down Expand Up @@ -241,11 +246,15 @@ export default async function init({
{ as: 'script', rel: 'modulepreload' },
);

const targetManifests = await getTargetPersonalization();
const { targetManifests, targetPropositions } = await getTargetPersonalization();
if (targetManifests?.length || persManifests?.length) {
const { preloadManifests, applyPers } = await import('../features/personalization/personalization.js');
const manifests = preloadManifests({ targetManifests, persManifests });
await applyPers(manifests, postLCP);
if (targetPropositions?.length && window._satellite) {
// eslint-disable-next-line no-underscore-dangle
window._satellite.track('propositionDisplay', targetPropositions);
}
}
}

Expand Down

0 comments on commit 40d1ced

Please sign in to comment.