Skip to content

Commit

Permalink
MWPW-152659 [MILO][MODAL][ANALYTICS] Analytic on modal load is missing (
Browse files Browse the repository at this point in the history
#2478)

* add check before overriding digitalData

* fix object creation to avoid erro
  • Loading branch information
vgoodric authored Jun 19, 2024
1 parent 0428594 commit 4bda3a5
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions libs/blocks/modal/modal.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-underscore-dangle */
/* eslint-disable import/no-cycle */
import { createTag, getMetadata, localizeLink, loadStyle, getConfig } from '../../utils/utils.js';

Expand All @@ -20,18 +21,15 @@ export function findDetails(hash, el) {
}

function fireAnalyticsEvent(event) {
// eslint-disable-next-line no-underscore-dangle
window._satellite?.track('event', {
const data = {
xdm: {},
data: {
web: { webInteraction: { name: event?.type } },
_adobe_corpnew: { digitalData: event?.data },
},
});
data: { web: { webInteraction: { name: event?.type } } },
};
if (event?.data) data.data._adobe_corpnew = { digitalData: event.data };
window._satellite?.track('event', data);
}

export function sendAnalytics(event) {
// eslint-disable-next-line no-underscore-dangle
if (window._satellite?.track) {
fireAnalyticsEvent(event);
} else {
Expand Down

0 comments on commit 4bda3a5

Please sign in to comment.