Add Analytics instrumentation to the Homepage

pull/21833/head
Michael Telatynski 2020-11-09 14:44:53 +00:00
parent e404934794
commit 453c956d06
1 changed files with 21 additions and 3 deletions

View File

@ -34,10 +34,26 @@ import {useEventEmitter} from "../../hooks/useEventEmitter";
import MatrixClientContext from "../../contexts/MatrixClientContext"; import MatrixClientContext from "../../contexts/MatrixClientContext";
import classNames from "classnames"; import classNames from "classnames";
import {ENTERING} from "react-transition-group/Transition"; import {ENTERING} from "react-transition-group/Transition";
import Analytics from "../../Analytics";
import CountlyAnalytics from "../../CountlyAnalytics";
const onClickSendDm = () => dis.dispatch({action: 'view_create_chat'}); const onClickSendDm = () => {
const onClickExplore = () => dis.fire(Action.ViewRoomDirectory); Analytics.trackEvent('home_page', 'button', 'dm');
const onClickNewRoom = () => dis.dispatch({action: 'view_create_room'}); CountlyAnalytics.instance.track("home_page_button", { button: "dm" });
dis.dispatch({action: 'view_create_chat'});
};
const onClickExplore = () => {
Analytics.trackEvent('home_page', 'button', 'room_directory');
CountlyAnalytics.instance.track("home_page_button", { button: "room_directory" });
dis.fire(Action.ViewRoomDirectory);
};
const onClickNewRoom = () => {
Analytics.trackEvent('home_page', 'button', 'create_room');
CountlyAnalytics.instance.track("home_page_button", { button: "create_room" });
dis.dispatch({action: 'view_create_room'});
};
interface IProps { interface IProps {
justRegistered?: boolean; justRegistered?: boolean;
@ -69,6 +85,8 @@ const UserWelcomeTop = () => {
onChange={async (ev) => { onChange={async (ev) => {
if (!ev.target.files?.length) return; if (!ev.target.files?.length) return;
setBusy(true); setBusy(true);
Analytics.trackEvent("home_page", "upload_avatar");
CountlyAnalytics.instance.track("home_page_upload_avatar");
const file = ev.target.files[0]; const file = ev.target.files[0];
const uri = await cli.uploadContent(file); const uri = await cli.uploadContent(file);
await cli.setAvatarUrl(uri); await cli.setAvatarUrl(uri);