From b527cebaf7ff3f02eaf613f1737ad7bfb30e2ce3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gergely=20Cs=C3=A9csey?= Date: Fri, 13 Sep 2024 15:33:50 +0100 Subject: [PATCH] add tracks event for emails subscription --- .../performance-profiler/pages/weekly-report/index.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client/performance-profiler/pages/weekly-report/index.tsx b/client/performance-profiler/pages/weekly-report/index.tsx index 9669039bf5eefd..65a0264b5437e2 100644 --- a/client/performance-profiler/pages/weekly-report/index.tsx +++ b/client/performance-profiler/pages/weekly-report/index.tsx @@ -2,6 +2,7 @@ import { useTranslate } from 'i18n-calypso'; import { useEffect } from 'react'; import DocumentHead from 'calypso/components/data/document-head'; import { useLeadMutation } from 'calypso/data/site-profiler/use-lead-query'; +import { recordTracksEvent } from 'calypso/lib/analytics/tracks'; import { MessageDisplay, ErrorSecondLine, @@ -21,6 +22,15 @@ export const WeeklyReport = ( props: WeeklyReportProps ) => { mutate(); }, [ mutate ] ); + useEffect( () => { + if ( isSuccess ) { + recordTracksEvent( 'calypso_performance_profiler_emails_subscribe', { + url, + hash, + } ); + } + }, [ isSuccess, url, hash ] ); + const secondaryMessage = translate( 'You can stop receiving performance reports at any time by clicking the Unsubscribe link in the email footer.' );