From 4786265e04668d47d7a47506dfa4415ad01b9e7e Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Tue, 10 Jan 2023 23:57:41 +0400 Subject: [PATCH] Refactor event tracking implementation --- src/components/Analytics/Analytics.astro | 28 ++++++++- src/components/DownloadPopup.astro | 14 ++++- src/components/Footer.astro | 18 ++++-- src/components/ResourcesAlert.astro | 6 +- src/components/RoadmapHeader.astro | 79 +++++++++++++----------- src/components/Sponsor/Sponsor.astro | 4 +- src/components/SubscribePopup.astro | 4 +- src/components/YouTubeBanner.astro | 31 +++++++--- 8 files changed, 127 insertions(+), 57 deletions(-) diff --git a/src/components/Analytics/Analytics.astro b/src/components/Analytics/Analytics.astro index cb8d627b9..e0c068612 100644 --- a/src/components/Analytics/Analytics.astro +++ b/src/components/Analytics/Analytics.astro @@ -2,7 +2,8 @@ --- - + diff --git a/src/components/DownloadPopup.astro b/src/components/DownloadPopup.astro index 3c15b2173..82aa6e90e 100644 --- a/src/components/DownloadPopup.astro +++ b/src/components/DownloadPopup.astro @@ -34,9 +34,21 @@ import CaptchaFields from './Captcha/CaptchaFields.astro'; type='submit' name='submit' class='text-white bg-gradient-to-r from-amber-700 to-blue-800 hover:from-amber-800 hover:to-blue-900 font-regular rounded-md text-md px-5 py-2.5 w-full text-center mr-2' - onclick="window.fireEvent({ category: 'Subscription', action: 'Submitted Popup Form', label: 'Download Roadmap Popup' })" + submit-download-form > Send Link + + diff --git a/src/components/Footer.astro b/src/components/Footer.astro index c23b33e97..9e36eb126 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -84,23 +84,29 @@ import Icon from './Icon.astro';

DevOps · Kubernetes · Cloud-Native

diff --git a/src/components/ResourcesAlert.astro b/src/components/ResourcesAlert.astro index ac0604ecf..8db765afd 100644 --- a/src/components/ResourcesAlert.astro +++ b/src/components/ResourcesAlert.astro @@ -29,10 +29,12 @@ const roadmapTitle =

Get the latest {roadmapTitle} news from our sister site{' '} TheNewStack.io diff --git a/src/components/RoadmapHeader.astro b/src/components/RoadmapHeader.astro index c102c4963..e53468995 100644 --- a/src/components/RoadmapHeader.astro +++ b/src/components/RoadmapHeader.astro @@ -1,8 +1,8 @@ --- -import Icon from "./Icon.astro"; -import ResourcesAlert from "./ResourcesAlert.astro"; -import TopicSearch from "./TopicSearch/TopicSearch.astro"; -import YouTubeAlert from "./YouTubeAlert.astro"; +import Icon from './Icon.astro'; +import ResourcesAlert from './ResourcesAlert.astro'; +import TopicSearch from './TopicSearch/TopicSearch.astro'; +import YouTubeAlert from './YouTubeAlert.astro'; export interface Props { title: string; @@ -22,50 +22,57 @@ const { hasTopics = false, } = Astro.props; - const isRoadmapReady = !isUpcoming; --- -

-
+
+
-
-

+
+

{title}

-

{description}

+

{description}

-
-
+
+
{ !hasSearch && ( <> - - ← - + + ← + {isRoadmapReady && ( )} ) @@ -75,11 +82,11 @@ const isRoadmapReady = !isUpcoming; hasSearch && ( ← -  Visual Roadmap +  Visual Roadmap ) } @@ -89,13 +96,13 @@ const isRoadmapReady = !isUpcoming; isRoadmapReady && ( - - - Suggest + + + Suggest ) } diff --git a/src/components/Sponsor/Sponsor.astro b/src/components/Sponsor/Sponsor.astro index bb51a4441..4861cc5fe 100644 --- a/src/components/Sponsor/Sponsor.astro +++ b/src/components/Sponsor/Sponsor.astro @@ -26,7 +26,9 @@ const { id='sponsor-ad' target='_blank' rel='noopener sponsored' - onclick={event ? `window.fireEvent(${JSON.stringify(event)})` : ''} + ga-category={event?.category} + ga-action={event?.action} + ga-label={event?.label} class='fixed bottom-[15px] right-[20px] outline-transparent z-50 bg-white max-w-[330px] shadow-lg outline-0 hidden' > diff --git a/src/components/YouTubeBanner.astro b/src/components/YouTubeBanner.astro index f89f0ce1b..04c8d6276 100644 --- a/src/components/YouTubeBanner.astro +++ b/src/components/YouTubeBanner.astro @@ -1,12 +1,25 @@ --- -import Icon from "./Icon.astro"; +import Icon from './Icon.astro'; --- - \ No newline at end of file +