From 48cdaaf2941016a29e6a1e9df7a4ad5e387008cd Mon Sep 17 00:00:00 2001 From: Conor Macpherson Date: Thu, 20 Apr 2023 16:22:20 -0400 Subject: [PATCH 1/5] add telemetry event tracking for various button clicks. --- .../enterprise_edition_left_panel.tsx | 4 +++- .../self_hosted_expansion_modal/error_page.tsx | 12 ++++++++++-- .../self_hosted_expansion_modal/index.tsx | 2 +- .../self_hosted_expansion_modal/success_page.tsx | 4 +++- webapp/channels/src/utils/constants.tsx | 1 + 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/webapp/channels/src/components/admin_console/license_settings/enterprise_edition/enterprise_edition_left_panel.tsx b/webapp/channels/src/components/admin_console/license_settings/enterprise_edition/enterprise_edition_left_panel.tsx index 1a09207a64..e3fee21900 100644 --- a/webapp/channels/src/components/admin_console/license_settings/enterprise_edition/enterprise_edition_left_panel.tsx +++ b/webapp/channels/src/components/admin_console/license_settings/enterprise_edition/enterprise_edition_left_panel.tsx @@ -13,7 +13,7 @@ import {ClientLicense} from '@mattermost/types/config'; import {Client4} from 'mattermost-redux/client'; import {getRemainingDaysFromFutureTimestamp, toTitleCase} from 'utils/utils'; -import {FileTypes} from 'utils/constants'; +import {FileTypes, TELEMETRY_CATEGORIES} from 'utils/constants'; import {getSkuDisplayName} from 'utils/subscription'; import {calculateOverageUserActivated} from 'utils/overage_team'; import {getConfig} from 'mattermost-redux/selectors/entities/admin'; @@ -24,6 +24,7 @@ import useCanSelfHostedExpand from 'components/common/hooks/useCanSelfHostedExpa import {getExpandSeatsLink} from 'selectors/cloud'; import useControlSelfHostedExpansionModal from 'components/common/hooks/useControlSelfHostedExpansionModal'; import {useQuery} from 'utils/http_utils'; +import {trackEvent} from 'actions/telemetry_actions'; const DAYS_UNTIL_EXPIRY_WARNING_DISPLAY_THRESHOLD = 30; const DAYS_UNTIL_EXPIRY_DANGER_DISPLAY_THRESHOLD = 5; @@ -100,6 +101,7 @@ const EnterpriseEditionLeftPanel = ({ ); const handleClickAddSeats = () => { + trackEvent(TELEMETRY_CATEGORIES.SELF_HOSTED_EXPANSION, 'add_seats_clicked'); if (!isSelfHostedPurchaseEnabled || !canExpand) { window.open(expandableLink(unsanitizedLicense.Id), '_blank'); } else { diff --git a/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/error_page.tsx b/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/error_page.tsx index e0ca48f22a..fc8f74e54e 100644 --- a/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/error_page.tsx +++ b/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/error_page.tsx @@ -10,6 +10,8 @@ import PaymentFailedSvg from 'components/common/svg_images_components/payment_fa import IconMessage from 'components/purchase_modal/icon_message'; import './error_page.scss'; +import {trackEvent} from 'actions/telemetry_actions'; +import {TELEMETRY_CATEGORIES} from 'utils/constants'; interface Props { canRetry: boolean; @@ -71,9 +73,15 @@ export default function SelfHostedExpansionErrorPage(props: Props) { icon={icon} error={true} formattedButtonText={formattedButtonText} - buttonHandler={props.tryAgain} + buttonHandler={() => { + trackEvent(TELEMETRY_CATEGORIES.SELF_HOSTED_EXPANSION, 'self_hosted_expansion_failure_try_again_clicked'); + props.tryAgain(); + }} formattedTertiaryButonText={tertiaryButtonText} - tertiaryButtonHandler={() => window.open(contactSupportLink, '_blank', 'noreferrer')} + tertiaryButtonHandler={() => { + trackEvent(TELEMETRY_CATEGORIES.SELF_HOSTED_EXPANSION, 'self_hosted_expansion_failure_contact_support_clicked'); + window.open(contactSupportLink, '_blank', 'noreferrer'); + }} /> ); diff --git a/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/index.tsx b/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/index.tsx index b66a81f517..41e1bedb98 100644 --- a/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/index.tsx +++ b/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/index.tsx @@ -19,7 +19,7 @@ import {Client4} from 'mattermost-redux/client'; import {isDevModeEnabled} from 'selectors/general'; import {closeModal} from 'actions/views/modals'; -import {pageVisited} from 'actions/telemetry_actions'; +import {pageVisited, trackEvent} from 'actions/telemetry_actions'; import {confirmSelfHostedExpansion} from 'actions/hosted_customer'; import {ValueOf} from '@mattermost/types/utilities'; diff --git a/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/success_page.tsx b/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/success_page.tsx index f8c362780c..224bbd4c89 100644 --- a/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/success_page.tsx +++ b/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/success_page.tsx @@ -8,9 +8,10 @@ import {useHistory} from 'react-router-dom'; import IconMessage from 'components/purchase_modal/icon_message'; import PaymentSuccessStandardSvg from 'components/common/svg_images_components/payment_success_standard_svg'; -import {ConsolePages} from 'utils/constants'; +import {ConsolePages, TELEMETRY_CATEGORIES} from 'utils/constants'; import './success_page.scss'; +import {trackEvent} from 'actions/telemetry_actions'; interface Props { onClose: () => void; @@ -34,6 +35,7 @@ export default function SelfHostedExpansionSuccessPage(props: Props) { { + trackEvent(TELEMETRY_CATEGORIES.SELF_HOSTED_EXPANSION, 'self_hosted_expansion_success_screen_closed'); history.push(ConsolePages.BILLING_HISTORY); props.onClose(); }} diff --git a/webapp/channels/src/utils/constants.tsx b/webapp/channels/src/utils/constants.tsx index 652e102586..0b6f982e17 100644 --- a/webapp/channels/src/utils/constants.tsx +++ b/webapp/channels/src/utils/constants.tsx @@ -769,6 +769,7 @@ export const TELEMETRY_CATEGORIES = { REQUEST_BUSINESS_EMAIL: 'request_business_email', TRUE_UP_REVIEW: 'true_up_review', WORK_TEMPLATES: 'work_templates', + SELF_HOSTED_EXPANSION: 'self_hosted_expansion', }; export const TELEMETRY_LABELS = { From fc47d9b056e41bebf822665219d4d60e6b77ae98 Mon Sep 17 00:00:00 2001 From: Conor Macpherson Date: Mon, 24 Apr 2023 09:26:01 -0400 Subject: [PATCH 2/5] lint. --- .../self_hosted_expansion_modal/error_page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/error_page.tsx b/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/error_page.tsx index fc8f74e54e..0144589b71 100644 --- a/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/error_page.tsx +++ b/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/error_page.tsx @@ -78,7 +78,7 @@ export default function SelfHostedExpansionErrorPage(props: Props) { props.tryAgain(); }} formattedTertiaryButonText={tertiaryButtonText} - tertiaryButtonHandler={() => { + tertiaryButtonHandler={() => { trackEvent(TELEMETRY_CATEGORIES.SELF_HOSTED_EXPANSION, 'self_hosted_expansion_failure_contact_support_clicked'); window.open(contactSupportLink, '_blank', 'noreferrer'); }} From 0a5b0e54d00ad8308a625fa245bda6065d1ee215 Mon Sep 17 00:00:00 2001 From: Conor Macpherson <116016004+ConorMacpherson@users.noreply.github.com> Date: Mon, 24 Apr 2023 09:33:11 -0400 Subject: [PATCH 3/5] Update constants.tsx --- webapp/channels/src/utils/constants.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/webapp/channels/src/utils/constants.tsx b/webapp/channels/src/utils/constants.tsx index 0b6f982e17..652e102586 100644 --- a/webapp/channels/src/utils/constants.tsx +++ b/webapp/channels/src/utils/constants.tsx @@ -769,7 +769,6 @@ export const TELEMETRY_CATEGORIES = { REQUEST_BUSINESS_EMAIL: 'request_business_email', TRUE_UP_REVIEW: 'true_up_review', WORK_TEMPLATES: 'work_templates', - SELF_HOSTED_EXPANSION: 'self_hosted_expansion', }; export const TELEMETRY_LABELS = { From 31d13fdb0a88e99302963d16c5e825f4f486fcce Mon Sep 17 00:00:00 2001 From: Conor Macpherson Date: Mon, 24 Apr 2023 09:40:10 -0400 Subject: [PATCH 4/5] remove unused import. --- .../self_hosted_purchases/self_hosted_expansion_modal/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/index.tsx b/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/index.tsx index 41e1bedb98..b66a81f517 100644 --- a/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/index.tsx +++ b/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/index.tsx @@ -19,7 +19,7 @@ import {Client4} from 'mattermost-redux/client'; import {isDevModeEnabled} from 'selectors/general'; import {closeModal} from 'actions/views/modals'; -import {pageVisited, trackEvent} from 'actions/telemetry_actions'; +import {pageVisited} from 'actions/telemetry_actions'; import {confirmSelfHostedExpansion} from 'actions/hosted_customer'; import {ValueOf} from '@mattermost/types/utilities'; From 700af71a0d7b9922ff296fc5a116d4451f7456c3 Mon Sep 17 00:00:00 2001 From: Conor Macpherson Date: Mon, 24 Apr 2023 10:54:40 -0400 Subject: [PATCH 5/5] Remove redundant self_hosted_expansion prefixes for telemetry events. --- .../self_hosted_expansion_modal/error_page.tsx | 4 ++-- .../self_hosted_expansion_modal/success_page.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/error_page.tsx b/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/error_page.tsx index 0144589b71..587e967752 100644 --- a/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/error_page.tsx +++ b/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/error_page.tsx @@ -74,12 +74,12 @@ export default function SelfHostedExpansionErrorPage(props: Props) { error={true} formattedButtonText={formattedButtonText} buttonHandler={() => { - trackEvent(TELEMETRY_CATEGORIES.SELF_HOSTED_EXPANSION, 'self_hosted_expansion_failure_try_again_clicked'); + trackEvent(TELEMETRY_CATEGORIES.SELF_HOSTED_EXPANSION, 'failure_try_again_clicked'); props.tryAgain(); }} formattedTertiaryButonText={tertiaryButtonText} tertiaryButtonHandler={() => { - trackEvent(TELEMETRY_CATEGORIES.SELF_HOSTED_EXPANSION, 'self_hosted_expansion_failure_contact_support_clicked'); + trackEvent(TELEMETRY_CATEGORIES.SELF_HOSTED_EXPANSION, 'failure_contact_support_clicked'); window.open(contactSupportLink, '_blank', 'noreferrer'); }} /> diff --git a/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/success_page.tsx b/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/success_page.tsx index 224bbd4c89..c750b7829f 100644 --- a/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/success_page.tsx +++ b/webapp/channels/src/components/self_hosted_purchases/self_hosted_expansion_modal/success_page.tsx @@ -35,7 +35,7 @@ export default function SelfHostedExpansionSuccessPage(props: Props) { { - trackEvent(TELEMETRY_CATEGORIES.SELF_HOSTED_EXPANSION, 'self_hosted_expansion_success_screen_closed'); + trackEvent(TELEMETRY_CATEGORIES.SELF_HOSTED_EXPANSION, 'success_screen_closed'); history.push(ConsolePages.BILLING_HISTORY); props.onClose(); }}