From b4f3601eaf1a53316c67de5f2ab52f6fcaf2866b Mon Sep 17 00:00:00 2001 From: pgilmore-phi Date: Fri, 10 Jan 2025 12:41:38 -0500 Subject: [PATCH 1/2] Deploy to main: PM-806: Add DL fallback for cta_locations (#311) * PM-806: Add DL fallback for cta_locations * PM-806: Add pumpkin wellness default cta_location --- blocks/header/header.js | 1 + scripts/scripts.js | 49 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/blocks/header/header.js b/blocks/header/header.js index 4827f78..7909aa8 100644 --- a/blocks/header/header.js +++ b/blocks/header/header.js @@ -299,6 +299,7 @@ function instrumentTrackingEvents(header) { // track cta clicks on header if (e.target.classList.contains('button')) { trackGTMEvent('cta_click', { + cta_location: 'header_cta', link_text: linkText, link_url: linkUrl, }); diff --git a/scripts/scripts.js b/scripts/scripts.js index ffe0367..b9d9ce8 100644 --- a/scripts/scripts.js +++ b/scripts/scripts.js @@ -314,9 +314,10 @@ function instrumentTrackingEvents(main) { ctaLocation = 'pick_your_plan'; } else if (e.target.closest('.curated-products-pumpkin-wellness')) { ctaLocation = 'join_the_club_footer'; + } else { + ctaLocation = 'join_the_club_banner'; } trackCTAEvent(ctaLocation); - // track .button cta clicks for paid pages } else if (body.className.includes('paid')) { if (e.target.closest('.hero-paid-membership')) { @@ -335,17 +336,53 @@ function instrumentTrackingEvents(main) { ctaLocation = 'body_1_cta'; } else if (e.target.closest('.callout-get-a-quote2')) { ctaLocation = 'body_2_cta'; + } else { + const containerBlock = e.target.closest('[data-block-name]'); + // if containerBlock is null, fallback to sections + if (containerBlock) { + const blockList = document.querySelectorAll(`[data-block-name=${containerBlock.dataset.blockName}]`); + blockList.forEach((block, key) => { + if (block === containerBlock) { + ctaLocation = `${containerBlock.dataset.blockName}_${key}`; + } + }); + } else { + // check for the closest section + const parentSection = e.target.closest('.section'); + if (parentSection) { + const sectionList = document.querySelectorAll('.section'); + sectionList.forEach((section, key) => { + if (section === parentSection) { + ctaLocation = `section_${key}`; + } + }); + } + } } trackCTAEvent(ctaLocation); return; } else { 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}`; + // if containerBlock is null, fallback to sections + if (containerBlock) { + const blockList = document.querySelectorAll(`[data-block-name=${containerBlock.dataset.blockName}]`); + blockList.forEach((block, key) => { + if (block === containerBlock) { + ctaLocation = `${containerBlock.dataset.blockName}_${key}`; + } + }); + } else { + // check for the closest section + const parentSection = e.target.closest('.section'); + if (parentSection) { + const sectionList = document.querySelectorAll('.section'); + sectionList.forEach((section, key) => { + if (section === parentSection) { + ctaLocation = `section_${key}`; + } + }); } - }); + } trackCTAEvent(ctaLocation); return; } From f6e67fc81247a193702069453c5aef58c7aacfb7 Mon Sep 17 00:00:00 2001 From: pgilmore-phi Date: Thu, 16 Jan 2025 11:10:43 -0500 Subject: [PATCH 2/2] Sync to Main: PM-756 (#313) * PM-756: Add noindex pages to robots.txt * PM-756: add blog exclude paths for helix-query --- helix-query.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/helix-query.yaml b/helix-query.yaml index 282b339..58f57c4 100644 --- a/helix-query.yaml +++ b/helix-query.yaml @@ -6,7 +6,9 @@ indices: - /blog/** exclude: - /blog + - /blog/main-blog - /blog/fragments/** + - /blog/experiments/** target: /blog/query-index.json properties: lastModified: @@ -30,6 +32,10 @@ indices: tags: select: head > meta[property="article:tag"] values: attribute(el, 'content') + robots: + select: head > meta[name="robots"] + value: | + attribute(el, 'content') blog_ca: include: - /ca/blog/** @@ -58,6 +64,10 @@ indices: tags: select: head > meta[property="article:tag"] values: attribute(el, 'content') + robots: + select: head > meta[name="robots"] + value: | + attribute(el, 'content') site_us: include: - /**