From 8ef930a2f961fb82c09295f05a0659e1e6317d89 Mon Sep 17 00:00:00 2001 From: chasls2 <110061741+chasls2@users.noreply.github.com> Date: Tue, 27 Aug 2024 10:39:08 -0500 Subject: [PATCH 1/8] FDG analytics hover update --- .../homepage-tile/homepage-tile.jsx | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/components/topics-section/homepage-tile/homepage-tile.jsx b/src/components/topics-section/homepage-tile/homepage-tile.jsx index ca3e6999b..9fafc1b8e 100644 --- a/src/components/topics-section/homepage-tile/homepage-tile.jsx +++ b/src/components/topics-section/homepage-tile/homepage-tile.jsx @@ -86,11 +86,32 @@ const ExplainerTile = ({ content, images, width, layout, hasMobileImage, explain eventLabel: label, }); }; - + let gaTimerDebt100Yrs; + let ga4Timer; + const handleMouseEnter = label => { + gaTimerDebt100Yrs = setTimeout(() => { + Analytics.event({ + category: 'Homepage Cards', + action: 'Card Hover', + label: label, + }); + }, 3000); + ga4Timer = setTimeout(() => { + window.dataLayer = window.dataLayer || []; + window.dataLayer.push({ + event: 'dap_event', + }); + }, 3000); + }; return ( <> {content.path ? ( - analyticsHandler('Citation Click', content.analyticsName)}> + analyticsHandler('Citation Click', content.analyticsName)} + onMouseEnter={() => handleMouseEnter(content.analyticsName)} + > {card} ) : ( From b551683c911df4aef30b6957819af08f9e6d6ab5 Mon Sep 17 00:00:00 2001 From: chasls2 <110061741+chasls2@users.noreply.github.com> Date: Tue, 27 Aug 2024 11:59:40 -0500 Subject: [PATCH 2/8] update --- src/components/datasets/topics/topic/topic.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/datasets/topics/topic/topic.jsx b/src/components/datasets/topics/topic/topic.jsx index fddee2540..d8937f4a5 100644 --- a/src/components/datasets/topics/topic/topic.jsx +++ b/src/components/datasets/topics/topic/topic.jsx @@ -8,6 +8,7 @@ import { ga4DataLayerPush } from '../../../../helpers/google-analytics/google-an export const topicIconAnalyticsEvent = { category: 'Dataset Search Page', action: 'Topics Filter Click', + name: 'dap_event', }; const Topic = ({ active, filterKey, label, onChange, image }) => { From a41acec382625a50ab8ac49f6b7432b22aaf1b26 Mon Sep 17 00:00:00 2001 From: chasls2 <110061741+chasls2@users.noreply.github.com> Date: Tue, 27 Aug 2024 12:15:25 -0500 Subject: [PATCH 3/8] update --- .../topics-section/homepage-tile/homepage-tile.jsx | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/components/topics-section/homepage-tile/homepage-tile.jsx b/src/components/topics-section/homepage-tile/homepage-tile.jsx index 9fafc1b8e..0d911a9d9 100644 --- a/src/components/topics-section/homepage-tile/homepage-tile.jsx +++ b/src/components/topics-section/homepage-tile/homepage-tile.jsx @@ -96,12 +96,6 @@ const ExplainerTile = ({ content, images, width, layout, hasMobileImage, explain label: label, }); }, 3000); - ga4Timer = setTimeout(() => { - window.dataLayer = window.dataLayer || []; - window.dataLayer.push({ - event: 'dap_event', - }); - }, 3000); }; return ( <> From 6e33eb9ff0f52db078bf9a2849cbcb3da35aee16 Mon Sep 17 00:00:00 2001 From: chasls2 <110061741+chasls2@users.noreply.github.com> Date: Tue, 27 Aug 2024 12:24:27 -0500 Subject: [PATCH 4/8] FDG-9520 removing the dap_event name from topicIconAnalyticsEvent on the topics.jsx component --- src/components/datasets/topics/topic/topic.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/datasets/topics/topic/topic.jsx b/src/components/datasets/topics/topic/topic.jsx index d8937f4a5..fddee2540 100644 --- a/src/components/datasets/topics/topic/topic.jsx +++ b/src/components/datasets/topics/topic/topic.jsx @@ -8,7 +8,6 @@ import { ga4DataLayerPush } from '../../../../helpers/google-analytics/google-an export const topicIconAnalyticsEvent = { category: 'Dataset Search Page', action: 'Topics Filter Click', - name: 'dap_event', }; const Topic = ({ active, filterKey, label, onChange, image }) => { From 4b571313a91487b07afea0237b8fc67a690e0830 Mon Sep 17 00:00:00 2001 From: chasls2 <110061741+chasls2@users.noreply.github.com> Date: Tue, 27 Aug 2024 12:35:52 -0500 Subject: [PATCH 5/8] FDG-9526 --- src/components/topics-section/homepage-tile/homepage-tile.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/topics-section/homepage-tile/homepage-tile.jsx b/src/components/topics-section/homepage-tile/homepage-tile.jsx index 0d911a9d9..a2f2136f6 100644 --- a/src/components/topics-section/homepage-tile/homepage-tile.jsx +++ b/src/components/topics-section/homepage-tile/homepage-tile.jsx @@ -86,10 +86,10 @@ const ExplainerTile = ({ content, images, width, layout, hasMobileImage, explain eventLabel: label, }); }; - let gaTimerDebt100Yrs; + let homepageTile; let ga4Timer; const handleMouseEnter = label => { - gaTimerDebt100Yrs = setTimeout(() => { + homepageTile = setTimeout(() => { Analytics.event({ category: 'Homepage Cards', action: 'Card Hover', From e9c9a1c21ffba8f315074900265542117cd176ea Mon Sep 17 00:00:00 2001 From: chasls2 <110061741+chasls2@users.noreply.github.com> Date: Tue, 27 Aug 2024 12:45:15 -0500 Subject: [PATCH 6/8] FDG-9526 added a reset timer --- .../topics-section/homepage-tile/homepage-tile.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/topics-section/homepage-tile/homepage-tile.jsx b/src/components/topics-section/homepage-tile/homepage-tile.jsx index a2f2136f6..3d67c5048 100644 --- a/src/components/topics-section/homepage-tile/homepage-tile.jsx +++ b/src/components/topics-section/homepage-tile/homepage-tile.jsx @@ -22,6 +22,7 @@ import { Grid } from '@material-ui/core'; import Analytics from '../../../utils/analytics/analytics'; import { ga4DataLayerPush } from '../../../helpers/google-analytics/google-analytics-helper'; +let homepageTile; const ExplainerTile = ({ content, images, width, layout, hasMobileImage, explainerTile }) => { let desktopImage, mobileImage; if (images) { @@ -86,8 +87,7 @@ const ExplainerTile = ({ content, images, width, layout, hasMobileImage, explain eventLabel: label, }); }; - let homepageTile; - let ga4Timer; + const handleMouseEnter = label => { homepageTile = setTimeout(() => { Analytics.event({ @@ -97,6 +97,10 @@ const ExplainerTile = ({ content, images, width, layout, hasMobileImage, explain }); }, 3000); }; + const handleMouseLeave = () => { + clearTimeout(homepageTile); + console.log('here'); + }; return ( <> {content.path ? ( @@ -105,6 +109,7 @@ const ExplainerTile = ({ content, images, width, layout, hasMobileImage, explain data-testid={'tile-link'} onClick={() => analyticsHandler('Citation Click', content.analyticsName)} onMouseEnter={() => handleMouseEnter(content.analyticsName)} + onMouseLeave={handleMouseLeave} > {card} From 6163453ffdb8c99defd76a9b1c9d6528afdeed90 Mon Sep 17 00:00:00 2001 From: chasls2 <110061741+chasls2@users.noreply.github.com> Date: Tue, 27 Aug 2024 13:04:20 -0500 Subject: [PATCH 7/8] FDG-9526 added event for citation click on the home page --- .../home-main-content/home-main-content.jsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/home-main-content/home-main-content.jsx b/src/components/home-main-content/home-main-content.jsx index ba8949e25..37c4af279 100644 --- a/src/components/home-main-content/home-main-content.jsx +++ b/src/components/home-main-content/home-main-content.jsx @@ -4,10 +4,19 @@ import HomeHighlightCards from '../home-highlight-cards/home-highlight-cards'; import { mainContent, sectionHeader, highlightCardsHeader } from './home-main-content.module.scss'; import { faChartColumn } from '@fortawesome/free-solid-svg-icons'; import CustomLink from '../links/custom-link/custom-link'; +import Analytics from '../../utils/analytics/analytics'; +import { ga4DataLayerPush } from '../../helpers/google-analytics/google-analytics-helper'; const HomeMainContent = () => { + const analyticsHandler = label => { + Analytics.event({ + category: 'Homepage Navigation', + action: 'Citation Click', + label: label, + }); + }; const datasetSearchPage = ( - + analyticsHandler('Dataset Search')}> Dataset Search page ); From f267b311849683e25de14e49647433c83856a7ad Mon Sep 17 00:00:00 2001 From: chasls2 <110061741+chasls2@users.noreply.github.com> Date: Tue, 27 Aug 2024 15:00:52 -0500 Subject: [PATCH 8/8] FDG-9526 Removed console --- src/components/topics-section/homepage-tile/homepage-tile.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/topics-section/homepage-tile/homepage-tile.jsx b/src/components/topics-section/homepage-tile/homepage-tile.jsx index 3d67c5048..00576e9bb 100644 --- a/src/components/topics-section/homepage-tile/homepage-tile.jsx +++ b/src/components/topics-section/homepage-tile/homepage-tile.jsx @@ -99,7 +99,6 @@ const ExplainerTile = ({ content, images, width, layout, hasMobileImage, explain }; const handleMouseLeave = () => { clearTimeout(homepageTile); - console.log('here'); }; return ( <>