Skip to content

Commit

Permalink
add tracks event for emails subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
gcsecsey committed Sep 13, 2024
1 parent 5d600a8 commit b527ceb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions client/performance-profiler/pages/weekly-report/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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.'
);
Expand Down

0 comments on commit b527ceb

Please sign in to comment.