Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions _src/scripts/target.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export async function runTargetExperiment(experimentUrl, experimentId) {
export function appendAdobeMcLinks(selector) {
try {
const wrapperSelector = typeof selector === 'string' ? document.querySelector(selector) : selector;
const isFooterSelector = Boolean(wrapperSelector.querySelector('.footer-2025__content'));

// mimic production hostname on local env
const pageUrlHostname = window.location.hostname === 'localhost'
Expand All @@ -99,6 +100,14 @@ export function appendAdobeMcLinks(selector) {
wrapperSelector.querySelectorAll(hrefSelector).forEach(async (link) => {
if (link.hostname !== pageUrlHostname
&& !Constants.DOMAINS_WITHOUT_ADOBE_MC.includes(link.hostname)) {
if (isFooterSelector) {
link.addEventListener('click', async (e) => {
e.preventDefault();
window.location.assign(await target.appendVisitorIDsTo(link.href));
});
return;
}

const destinationURLWithVisitorIDs = await target.appendVisitorIDsTo(link.href);
link.href = destinationURLWithVisitorIDs.replace(/MCAID%3D.*%7CMCORGID/, 'MCAID%3D%7CMCORGID');
}
Expand Down
Loading