From 6ae09a3911616b6eb2a46e59f625987a5f3ae555 Mon Sep 17 00:00:00 2001 From: theankit-sinha Date: Thu, 1 Aug 2024 21:47:50 +0530 Subject: [PATCH 1/3] Query Parms update & sendTargetResponse function update (#2664) * Query Parms update & sendTargetResponse function update - sendTargetResponse: Added Check for window._satellite and changed direct alloy call to _satellite call - Added additional parameter as marketingtech to disable analytics calls * Query Parms update & sendTargetResponse function update - Updated conditional chaining --------- Co-authored-by: milo-pr-merge[bot] <169241390+milo-pr-merge[bot]@users.noreply.github.com> --- libs/martech/martech.js | 24 ++++++++++++------------ libs/utils/utils.js | 5 +++-- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/libs/martech/martech.js b/libs/martech/martech.js index fac3ef32a8..a400fd7c6d 100644 --- a/libs/martech/martech.js +++ b/libs/martech/martech.js @@ -89,20 +89,20 @@ function sendTargetResponseAnalytics(failure, responseStart, timeout, message) { const timeoutTime = roundToQuarter(timeout); let val = `target response time ${responseTime}:timed out ${failure}:timeout ${timeoutTime}`; if (message) val += `:${message}`; - window.alloy('sendEvent', { - documentUnloading: true, - xdm: { - eventType: 'web.webinteraction.linkClicks', - web: { - webInteraction: { - linkClicks: { value: 1 }, - type: 'other', - name: val, + window._satellite?.track?.('event', { + documentUnloading: true, + xdm: { + eventType: 'web.webinteraction.linkClicks', + web: { + webInteraction: { + linkClicks: { value: 1 }, + type: 'other', + name: val, + }, }, }, - }, - data: { _adobe_corpnew: { digitalData: { primaryEvent: { eventInfo: { eventName: val } } } } }, - }); + data: { _adobe_corpnew: { digitalData: { primaryEvent: { eventInfo: { eventName: val } } } } }, + }); } export const getTargetPersonalization = async () => { diff --git a/libs/utils/utils.js b/libs/utils/utils.js index 5feb6d18c7..ca0afba9e7 100644 --- a/libs/utils/utils.js +++ b/libs/utils/utils.js @@ -865,8 +865,9 @@ export async function loadMartech({ return true; } - const query = PAGE_URL.searchParams.get('martech'); - if (query === 'off' || getMetadata('martech') === 'off') { + const martechQuery = PAGE_URL.searchParams.get('martech'); + const marketingQuery = PAGE_URL.searchParams.get('marketingtech'); + if (martechQuery === 'off' || marketingQuery === 'off' || getMetadata('martech') === 'off') { return false; } From 38b6774907a89c025725e2f04722447edbb1e321 Mon Sep 17 00:00:00 2001 From: vgoodric Date: Thu, 1 Aug 2024 10:23:50 -0600 Subject: [PATCH 2/3] Update martech.js --- libs/martech/martech.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/libs/martech/martech.js b/libs/martech/martech.js index a400fd7c6d..32df8bf052 100644 --- a/libs/martech/martech.js +++ b/libs/martech/martech.js @@ -89,20 +89,21 @@ function sendTargetResponseAnalytics(failure, responseStart, timeout, message) { const timeoutTime = roundToQuarter(timeout); let val = `target response time ${responseTime}:timed out ${failure}:timeout ${timeoutTime}`; if (message) val += `:${message}`; - window._satellite?.track?.('event', { - documentUnloading: true, - xdm: { - eventType: 'web.webinteraction.linkClicks', - web: { - webInteraction: { - linkClicks: { value: 1 }, - type: 'other', - name: val, - }, + // eslint-disable-next-line no-underscore-dangle + window._satellite?.track?.('event', { + documentUnloading: true, + xdm: { + eventType: 'web.webinteraction.linkClicks', + web: { + webInteraction: { + linkClicks: { value: 1 }, + type: 'other', + name: val, }, }, - data: { _adobe_corpnew: { digitalData: { primaryEvent: { eventInfo: { eventName: val } } } } }, - }); + }, + data: { _adobe_corpnew: { digitalData: { primaryEvent: { eventInfo: { eventName: val } } } } }, + }); } export const getTargetPersonalization = async () => { From e118a27a49a20fbd78ef5e8138b6e716c4fc554e Mon Sep 17 00:00:00 2001 From: vgoodric Date: Thu, 1 Aug 2024 12:57:36 -0600 Subject: [PATCH 3/3] not caching values --- libs/utils/utils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/utils/utils.js b/libs/utils/utils.js index ca0afba9e7..a1bfbbd52d 100644 --- a/libs/utils/utils.js +++ b/libs/utils/utils.js @@ -865,9 +865,9 @@ export async function loadMartech({ return true; } - const martechQuery = PAGE_URL.searchParams.get('martech'); - const marketingQuery = PAGE_URL.searchParams.get('marketingtech'); - if (martechQuery === 'off' || marketingQuery === 'off' || getMetadata('martech') === 'off') { + if (PAGE_URL.searchParams.get('martech') === 'off' + || PAGE_URL.searchParams.get('marketingtech') === 'off' + || getMetadata('martech') === 'off') { return false; }