Ensure we send limited but important email editor information to mixpanel

We are limiting the amount of events information so as not to go over mixpanel monthly quota

MAILPOET-6365
This commit is contained in:
Oluwaseun Olorunsola
2025-01-07 14:08:58 +01:00
committed by Oluwaseun Olorunsola
parent d0326c4416
commit 2e207efce1
2 changed files with 27 additions and 3 deletions

View File

@ -11,14 +11,38 @@ addFilter('mailpoet_email_editor_wrap_editor_component', 'mailpoet', (editor) =>
withNpsPoll(editor), withNpsPoll(editor),
); );
const EVENTS_TO_TRACK = [
'email_editor_events_editor_layout_loaded', // email editor was opened
'email_editor_events_template_select_modal_template_selected', // a template was selected from the template-select modal
'email_editor_events_template_select_modal_start_from_scratch_clicked', // start from scratch
'email_editor_events_header_campaign_name_title_updated', // campaign title was used
'email_editor_events_header_preview_dropdown_mobile_selected', // preview option - mobile
'email_editor_events_header_preview_dropdown_desktop_selected', // preview option - desktop
'email_editor_events_header_preview_dropdown_send_test_email_selected', // preview option - send test email
'email_editor_events_sent_preview_email', // preview email sent
'email_editor_events_header_preview_dropdown_preview_in_new_tab_selected', // preview option - in new tab
'email_editor_events_rich_text_with_button_personalization_tags_shortcode_icon_clicked', // personalization_tags modal opened
'email_editor_events_personalization_tags_modal_tag_insert_button_clicked', // personalization_tags inserted
'email_editor_events_rich_text_with_button_input_field_updated', // either subject or preheader updated
'email_editor_events_styles_sidebar_screen_typography_opened', // styles sidebar was seen
'email_editor_events_styles_sidebar_screen_colors_opened', // styles sidebar was seen
'email_editor_events_styles_sidebar_screen_layout_opened', // styles sidebar was seen
'email_editor_events_header_send_button_clicked', // Send button clicked
'email_editor_events_trash_modal_move_to_trash_button_clicked', // Move to trash button was clicked
];
addAction('mailpoet_email_editor_events', 'mailpoet', (editorEvents) => { addAction('mailpoet_email_editor_events', 'mailpoet', (editorEvents) => {
const { name, ...data } = editorEvents; const { name, ...data } = editorEvents;
MailPoet.trackEvent(name, data); // To prevent going over mixpanel quota, we will limit the number of email editor events we track with mixpanel
// Tracks will log all events. This will be done in MAILPOET-5995
if (EVENTS_TO_TRACK.includes(String(name))) {
MailPoet.trackEvent(name, data);
}
}); });
// enable email editor event tracking // enable email editor event tracking
addFilter( addFilter(
'mailpoet_email_editor_events_tracking_enabled', 'mailpoet_email_editor_events_tracking_enabled',
'mailpoet', 'mailpoet',
() => window.mailpoet_analytics_enabled, () => !!window.mailpoet_analytics_enabled,
); );

View File

@ -14,7 +14,7 @@ const PersonalizationTagsModal = ( {
isOpened, isOpened,
closeCallback, closeCallback,
canInsertLink = false, canInsertLink = false,
openedBy = '', openedBy = '',
} ) => { } ) => {
const [ activeCategory, setActiveCategory ] = useState( null ); const [ activeCategory, setActiveCategory ] = useState( null );
const [ searchQuery, setSearchQuery ] = useState( '' ); const [ searchQuery, setSearchQuery ] = useState( '' );