Add event tracking for sidebar details section
MAILPOET-6365
This commit is contained in:
committed by
Oluwaseun Olorunsola
parent
1537cacbf4
commit
5de7df1433
@ -4,6 +4,7 @@ import { __ } from '@wordpress/i18n';
|
|||||||
import { createInterpolateElement } from '@wordpress/element';
|
import { createInterpolateElement } from '@wordpress/element';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import { RichTextWithButton } from '../personalization-tags/rich-text-with-button';
|
import { RichTextWithButton } from '../personalization-tags/rich-text-with-button';
|
||||||
|
import { recordEvent } from '../../events';
|
||||||
|
|
||||||
const previewTextMaxLength = 150;
|
const previewTextMaxLength = 150;
|
||||||
const previewTextRecommendedLength = 80;
|
const previewTextRecommendedLength = 80;
|
||||||
@ -27,6 +28,11 @@ export function DetailsPanel() {
|
|||||||
href="https://www.mailpoet.com/blog/17-email-subject-line-best-practices-to-boost-engagement/"
|
href="https://www.mailpoet.com/blog/17-email-subject-line-best-practices-to-boost-engagement/"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
|
onClick={ () =>
|
||||||
|
recordEvent(
|
||||||
|
'details_panel_subject_help_best_practice_link_clicked'
|
||||||
|
)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
emojiLink: (
|
emojiLink: (
|
||||||
@ -35,6 +41,11 @@ export function DetailsPanel() {
|
|||||||
href="https://www.mailpoet.com/blog/tips-using-emojis-in-subject-lines/"
|
href="https://www.mailpoet.com/blog/tips-using-emojis-in-subject-lines/"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
|
onClick={ () =>
|
||||||
|
recordEvent(
|
||||||
|
'details_panel_subject_help_emoji_in_subject_lines_link_clicked'
|
||||||
|
)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
@ -58,6 +69,10 @@ export function DetailsPanel() {
|
|||||||
key="preview-text-kb"
|
key="preview-text-kb"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
|
onClick={ () =>
|
||||||
|
recordEvent(
|
||||||
|
'details_panel_preheader_help_text_link_clicked'
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
@ -67,12 +82,20 @@ export function DetailsPanel() {
|
|||||||
<PanelBody
|
<PanelBody
|
||||||
title={ __( 'Details', 'mailpoet' ) }
|
title={ __( 'Details', 'mailpoet' ) }
|
||||||
className="mailpoet-email-editor__settings-panel"
|
className="mailpoet-email-editor__settings-panel"
|
||||||
|
onToggle={ ( data ) =>
|
||||||
|
recordEvent( 'details_panel_body_toggle', { opened: data } )
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<RichTextWithButton
|
<RichTextWithButton
|
||||||
attributeName="subject"
|
attributeName="subject"
|
||||||
label={ __( 'Subject', 'mailpoet' ) }
|
label={ __( 'Subject', 'mailpoet' ) }
|
||||||
labelSuffix={
|
labelSuffix={
|
||||||
<ExternalLink href="https://kb.mailpoet.com/article/435-a-guide-to-personalisation-tags-for-tailored-newsletters#list">
|
<ExternalLink
|
||||||
|
href="https://kb.mailpoet.com/article/435-a-guide-to-personalisation-tags-for-tailored-newsletters#list"
|
||||||
|
onClick={ () =>
|
||||||
|
recordEvent( 'details_panel_personalisation_tags_guide_link_clicked' )
|
||||||
|
}
|
||||||
|
>
|
||||||
{ __( 'Guide', 'mailpoet' ) }
|
{ __( 'Guide', 'mailpoet' ) }
|
||||||
</ExternalLink>
|
</ExternalLink>
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ import { TemplateSettings } from './template-settings';
|
|||||||
import { useEditorMode } from '../../hooks';
|
import { useEditorMode } from '../../hooks';
|
||||||
|
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
|
import { recordEvent } from '../../events';
|
||||||
|
|
||||||
type Props = React.ComponentProps< typeof ComplementaryArea >;
|
type Props = React.ComponentProps< typeof ComplementaryArea >;
|
||||||
|
|
||||||
@ -44,6 +45,7 @@ function SidebarContent( props: Props ) {
|
|||||||
return (
|
return (
|
||||||
<ComplementaryArea
|
<ComplementaryArea
|
||||||
identifier={ mainSidebarId }
|
identifier={ mainSidebarId }
|
||||||
|
closeLabel={ __( 'Close sidebar', 'mailpoet' ) }
|
||||||
headerClassName="editor-sidebar__panel-tabs"
|
headerClassName="editor-sidebar__panel-tabs"
|
||||||
className="edit-post-sidebar"
|
className="edit-post-sidebar"
|
||||||
header={
|
header={
|
||||||
@ -96,9 +98,10 @@ export function Sidebar( props: Props ) {
|
|||||||
return (
|
return (
|
||||||
<Tabs
|
<Tabs
|
||||||
selectedTabId={ activeTab || mainSidebarDocumentTab }
|
selectedTabId={ activeTab || mainSidebarDocumentTab }
|
||||||
onSelect={ ( key ) =>
|
onSelect={ ( key ) => {
|
||||||
toggleSettingsSidebarActiveTab( key as string )
|
recordEvent( 'sidebar_tab_selected', { tabKey: key } );
|
||||||
}
|
return toggleSettingsSidebarActiveTab( key as string );
|
||||||
|
} }
|
||||||
>
|
>
|
||||||
<SidebarContent { ...props } />
|
<SidebarContent { ...props } />
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
@ -84,8 +84,6 @@ export const closeSidebar =
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function toggleSettingsSidebarActiveTab( activeTab: string ) {
|
export function toggleSettingsSidebarActiveTab( activeTab: string ) {
|
||||||
recordEvent( 'editor-settings-sidebar-active-tab', { activeTab } );
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: 'TOGGLE_SETTINGS_SIDEBAR_ACTIVE_TAB',
|
type: 'TOGGLE_SETTINGS_SIDEBAR_ACTIVE_TAB',
|
||||||
state: { activeTab } as Partial< State[ 'settingsSidebar' ] >,
|
state: { activeTab } as Partial< State[ 'settingsSidebar' ] >,
|
||||||
|
Reference in New Issue
Block a user