diff --git a/blocks/plans-quote/form.js b/blocks/plans-quote/form.js index 1560429..ca3cc89 100644 --- a/blocks/plans-quote/form.js +++ b/blocks/plans-quote/form.js @@ -74,8 +74,8 @@ async function getPurchaseSummary(ownerId) { } export default function formDecoration(block) { - // if we are not editing, is not summary page and multipet is false - if (!isSummaryPage() && !isEditing && !isMultiPet) { + // if we are not editing, is not summary page + if (!isSummaryPage() && !isEditing) { // delete the saved owner id cookie deleteCookie(COOKIE_NAME_SAVED_OWNER_ID); } diff --git a/scripts/scripts.js b/scripts/scripts.js index 57c042b..ffe0367 100644 --- a/scripts/scripts.js +++ b/scripts/scripts.js @@ -187,6 +187,8 @@ export function changeDomain(block) { */ export function addCanadaToLinks(block) { if (isCanada) { + const EXEMPT_PATHS = ['privacy-policy']; // add paths that should not be rewritten + // check each link in the block block.querySelectorAll('a').forEach((anchor) => { if (anchor.getAttribute('rel') === 'alternate') return; const url = new URL(anchor.href); @@ -194,6 +196,8 @@ export function addCanadaToLinks(block) { if (url.hostname === window.location.hostname) { // change only for internal links if (!url.pathname.startsWith('/ca/')) { + // if any part of the url is in the exempt list, do not rewrite + if (EXEMPT_PATHS.some((path) => url.pathname.includes(path))) return; newUrl.pathname = `/ca${url.pathname}`; anchor.href = newUrl.toString(); } @@ -335,7 +339,14 @@ function instrumentTrackingEvents(main) { trackCTAEvent(ctaLocation); return; } else { - trackCTAEvent(null); + const containerBlock = e.target.closest('[data-block-name]'); + const blockList = document.querySelectorAll(`[data-block-name=${containerBlock.dataset.blockName}]`); + blockList.forEach((block, key) => { + if (block === containerBlock) { + ctaLocation = `${containerBlock.dataset.blockName}_${key}`; + } + }); + trackCTAEvent(ctaLocation); return; } }