From 2b95d82cec3886fe786606be83774586b8e0781d Mon Sep 17 00:00:00 2001 From: timngyn Date: Thu, 12 Oct 2023 10:23:49 -0700 Subject: [PATCH 1/2] Add a custom adobe analytics event for the WhatsNewBanner component --- src/components/WhatsNewBanner/index.tsx | 2 ++ src/utils/track.ts | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/components/WhatsNewBanner/index.tsx b/src/components/WhatsNewBanner/index.tsx index 95dd6e14665..9a2eb81e606 100644 --- a/src/components/WhatsNewBanner/index.tsx +++ b/src/components/WhatsNewBanner/index.tsx @@ -1,11 +1,13 @@ import { Link, View } from '@aws-amplify/ui-react'; import { FiArrowRightCircle } from 'react-icons/fi'; import { BannerContainer } from './styles'; +import { trackWhatsNewBanner } from '../../utils/track'; export default function WhatsNewBanner({ href, content }) { return ( { ); }); }; + +export const trackWhatsNewBanner = () => { + const opt = { + event: { + type: 'click', + name: 'WhatsNewBanner' + } + }; + + AWSMA.ready(() => { + document.dispatchEvent( + new CustomEvent(AWSMA.TRIGGER_EVENT, { detail: opt }) + ); + }); +}; From 9cfb9b114c8c33b46b7f5cb09fdab37e6ac90b5c Mon Sep 17 00:00:00 2001 From: timngyn Date: Thu, 12 Oct 2023 11:18:26 -0700 Subject: [PATCH 2/2] Add comment for function --- src/utils/track.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/track.ts b/src/utils/track.ts index 4fa52dba598..5c35881a8f9 100644 --- a/src/utils/track.ts +++ b/src/utils/track.ts @@ -199,6 +199,7 @@ export const trackCopyClicks = (data) => { }); }; +// Track the click on the "Whats new" banner component export const trackWhatsNewBanner = () => { const opt = { event: {