From f8e56613535a92a8fbdbcaf9d44181b668696674 Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Mon, 8 May 2023 20:54:56 +0100 Subject: [PATCH] Refactor perf issues --- src/components/Analytics/Analytics.astro | 25 ---------------------- src/components/BestPracticeHeader.astro | 11 +--------- src/components/Footer.astro | 9 -------- src/components/Navigation/Navigation.astro | 2 +- src/components/RoadmapHint.astro | 25 ++++++++++++++-------- src/layouts/BaseLayout.astro | 9 ++++++-- 6 files changed, 25 insertions(+), 56 deletions(-) diff --git a/src/components/Analytics/Analytics.astro b/src/components/Analytics/Analytics.astro index b2d6a35d4..b20b47cfc 100644 --- a/src/components/Analytics/Analytics.astro +++ b/src/components/Analytics/Analytics.astro @@ -14,29 +14,4 @@ gtag('js', new Date()); gtag('config', 'UA-139582634-1'); - - document.addEventListener('click', (e) => { - let trackEl = e.target; - if (!trackEl.getAttribute('ga-category')) { - trackEl = trackEl.closest('[ga-category]'); - } - - if (!trackEl) { - return; - } - - const category = trackEl.getAttribute('ga-category'); - const action = trackEl.getAttribute('ga-action'); - const label = trackEl.getAttribute('ga-label'); - - if (!category) { - return; - } - - window.fireEvent({ - category, - action, - label, - }); - }); diff --git a/src/components/BestPracticeHeader.astro b/src/components/BestPracticeHeader.astro index aecb32fde..6625e5782 100644 --- a/src/components/BestPracticeHeader.astro +++ b/src/components/BestPracticeHeader.astro @@ -1,7 +1,7 @@ --- -import BestPracticeHint from './BestPracticeHint.astro'; import Icon from './AstroIcon.astro'; import LoginPopup from './AuthenticationFlow/LoginPopup.astro'; +import BestPracticeHint from './BestPracticeHint.astro'; export interface Props { title: string; @@ -42,9 +42,6 @@ const isBestPracticeReady = !isUpcoming; data-popup='login-popup' class='hidden inline-flex items-center justify-center rounded-md bg-yellow-400 px-3 py-1.5 text-xs font-medium hover:bg-yellow-500 sm:text-sm' aria-label='Download Roadmap' - ga-category='Subscription' - ga-action='Clicked Popup Opener' - ga-label='Download Roadmap Popup' > @@ -58,9 +55,6 @@ const isBestPracticeReady = !isUpcoming; data-auth-required class='inline-flex hidden items-center justify-center rounded-md bg-yellow-400 px-3 py-1.5 text-xs font-medium hover:bg-yellow-500 sm:text-sm' aria-label='Download Roadmap' - ga-category='Subscription' - ga-action='Clicked Popup Opener' - ga-label='Download Roadmap Popup' target="_blank" href={`/pdfs/best-practices/${bestPracticeId}.pdf`} > @@ -75,9 +69,6 @@ const isBestPracticeReady = !isUpcoming; data-popup='login-popup' class='inline-flex hidden items-center justify-center rounded-md bg-yellow-400 px-3 py-1.5 text-xs font-medium hover:bg-yellow-500 sm:text-sm' aria-label='Subscribe for Updates' - ga-category='Subscription' - ga-action='Clicked Popup Opener' - ga-label='Subscribe Best Practice Popup' > Subscribe diff --git a/src/components/Footer.astro b/src/components/Footer.astro index 9b86b45b3..c544b5361 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -84,27 +84,18 @@ import Icon from './AstroIcon.astro'; DevOps · Kubernetes · Cloud-Native

diff --git a/src/components/Navigation/Navigation.astro b/src/components/Navigation/Navigation.astro index 7b02b05e2..aed4b36d1 100644 --- a/src/components/Navigation/Navigation.astro +++ b/src/components/Navigation/Navigation.astro @@ -5,7 +5,7 @@ import AccountDropdown from './AccountDropdown.astro';