diff --git a/packages/js/email-editor/src/components/autosave/autosave-monitor.tsx b/packages/js/email-editor/src/components/autosave/autosave-monitor.tsx index 94213cf438..a638b87094 100644 --- a/packages/js/email-editor/src/components/autosave/autosave-monitor.tsx +++ b/packages/js/email-editor/src/components/autosave/autosave-monitor.tsx @@ -1,6 +1,7 @@ import { useDispatch, useSelect } from '@wordpress/data'; import { useEffect } from '@wordpress/element'; import { storeName } from '../../store'; +import { recordEvent } from '../../events'; /** * This component is simplified version of the original one from @wordpress/editor package. @@ -25,6 +26,7 @@ export function AutosaveMonitor() { if ( hasEdits && autosaveInterval > 0 ) { autosaveTimer = setTimeout( () => { void saveEditedEmail(); + recordEvent( 'editor_content_auto_saved' ); }, autosaveInterval * 1000 ); } diff --git a/packages/js/email-editor/src/components/notices/sent-email-notice.tsx b/packages/js/email-editor/src/components/notices/sent-email-notice.tsx index 8eca7cf06f..f80dc30860 100644 --- a/packages/js/email-editor/src/components/notices/sent-email-notice.tsx +++ b/packages/js/email-editor/src/components/notices/sent-email-notice.tsx @@ -4,6 +4,7 @@ import { store as noticesStore } from '@wordpress/notices'; import { __ } from '@wordpress/i18n'; import { storeName } from '../../store'; +import { recordEvent } from '../../events'; export function SentEmailNotice() { const { isEmailSent } = useSelect( @@ -27,6 +28,7 @@ export function SentEmailNotice() { context: 'email-editor', } ); + recordEvent( 'editor_showed_email_sent_notice' ); } }, [ isEmailSent ] ); diff --git a/packages/js/email-editor/src/store/actions.ts b/packages/js/email-editor/src/store/actions.ts index b556260cef..d854589ab2 100644 --- a/packages/js/email-editor/src/store/actions.ts +++ b/packages/js/email-editor/src/store/actions.ts @@ -102,7 +102,6 @@ export function* saveEditedEmail() { ); result.then( () => { - recordEvent( 'editor-content-saved', { postId } ); void dispatch( noticesStore ).createErrorNotice( __( 'Email saved!', 'mailpoet' ), { @@ -114,7 +113,6 @@ export function* saveEditedEmail() { } ); result.catch( () => { - recordEvent( 'editor-content-not-saved', { postId } ); void dispatch( noticesStore ).createErrorNotice( __( 'The email could not be saved. Please, clear browser cache and reload the page. If the problem persists, duplicate the email and try again.',