diff --git a/components/purchase_modal/process_payment_setup.tsx b/components/purchase_modal/process_payment_setup.tsx index bc2b526356fc..9f34030dd8c6 100644 --- a/components/purchase_modal/process_payment_setup.tsx +++ b/components/purchase_modal/process_payment_setup.tsx @@ -5,6 +5,8 @@ import React from 'react'; import {Stripe} from '@stripe/stripe-js'; import {BillingDetails} from 'types/cloud/sku'; +import {pageVisited} from 'actions/telemetry_actions'; +import {TELEMETRY_CATEGORIES} from 'utils/constants'; import successSvg from 'images/cloud/payment_success.svg'; import failedSvg from 'images/cloud/payment_fail.svg'; @@ -138,6 +140,10 @@ export default class ProcessPaymentSetup extends React.PureComponent ); case ProcessState.SUCCESS: + pageVisited( + TELEMETRY_CATEGORIES.CLOUD_PURCHASING, + 'pageview_payment_success', + ); return ( ); case ProcessState.FAILED: + pageVisited( + TELEMETRY_CATEGORIES.CLOUD_PURCHASING, + 'pageview_payment_failed', + ); return ( { } componentDidMount() { + pageVisited(TELEMETRY_CATEGORIES.CLOUD_PURCHASING, 'pageview_purchase'); this.props.actions.getCloudProducts(); // this.fetchProductPrice(); @@ -117,6 +119,12 @@ export default class PurchaseModal extends React.PureComponent { + trackEvent( + TELEMETRY_CATEGORIES.CLOUD_PURCHASING, + 'click_contact_support', + ) + } href={this.props.contactSupportLink} rel='noopener noreferrer' target='_new' @@ -187,6 +195,12 @@ export default class PurchaseModal extends React.PureComponent {
{'Need other billing options?'}
{ + trackEvent( + TELEMETRY_CATEGORIES.CLOUD_PURCHASING, + 'click_contact_sales', + ); + }} href={this.props.contactSalesLink} target='_new' rel='noopener noreferrer' @@ -216,7 +230,13 @@ export default class PurchaseModal extends React.PureComponent { { + trackEvent( + TELEMETRY_CATEGORIES.CLOUD_PURCHASING, + 'click_close_purchasing_screen', + ); + this.props.actions.closeModal(); + }} ref={this.modal} ariaLabelledBy='purchase_modal_title' > diff --git a/components/user_limit_modal/user_limit_modal.tsx b/components/user_limit_modal/user_limit_modal.tsx index c929e2fa7ce8..02bf8a1d2832 100644 --- a/components/user_limit_modal/user_limit_modal.tsx +++ b/components/user_limit_modal/user_limit_modal.tsx @@ -1,11 +1,13 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React from 'react'; +import React, {useEffect} from 'react'; import {Modal, Button} from 'react-bootstrap'; import {FormattedMessage} from 'react-intl'; -import {ModalIdentifiers} from 'utils/constants'; +import {trackEvent, pageVisited} from 'actions/telemetry_actions'; + +import {ModalIdentifiers, TELEMETRY_CATEGORIES} from 'utils/constants'; import PurchaseModal from 'components/purchase_modal'; import UpgradeUserLimitModalSvg from './user_limit_upgrade_svg'; @@ -20,7 +22,18 @@ type Props = { }; export default function UserLimitModal(props: Props) { + useEffect(() => { + pageVisited( + TELEMETRY_CATEGORIES.CLOUD_PURCHASING, + 'pageview_modal_user_limit_reached', + ); + }, []); + const onSubmit = () => { + trackEvent( + TELEMETRY_CATEGORIES.CLOUD_PURCHASING, + 'click_modal_user_limit_upgrade', + ); props.actions.closeModal(); props.actions.openModal({ modalId: ModalIdentifiers.CLOUD_PURCHASE, @@ -29,6 +42,10 @@ export default function UserLimitModal(props: Props) { }; const close = () => { + trackEvent( + TELEMETRY_CATEGORIES.CLOUD_PURCHASING, + 'click_modal_user_limit_not_now', + ); props.actions.closeModal(); }; diff --git a/utils/constants.jsx b/utils/constants.jsx index e08e51461a80..c43aa4c5a624 100644 --- a/utils/constants.jsx +++ b/utils/constants.jsx @@ -405,6 +405,10 @@ export const CloudBanners = { HIDE: 'hide', }; +export const TELEMETRY_CATEGORIES = { + CLOUD_PURCHASING: 'cloud_purchasing', +}; + export const PostTypes = { JOIN_LEAVE: 'system_join_leave', JOIN_CHANNEL: 'system_join_channel',