Add telemetry for how many people use breadcrumbs
Fixes https://github.com/vector-im/riot-web/issues/9207
This commit is contained in:
parent
2496ee3b66
commit
035f6b14c0
4 changed files with 25 additions and 6 deletions
|
@ -27,6 +27,7 @@ import VectorConferenceHandler from '../../VectorConferenceHandler';
|
|||
import TagPanelButtons from './TagPanelButtons';
|
||||
import SettingsStore from '../../settings/SettingsStore';
|
||||
import {_t} from "../../languageHandler";
|
||||
import Analytics from "../../Analytics";
|
||||
|
||||
|
||||
const LeftPanel = React.createClass({
|
||||
|
@ -53,10 +54,11 @@ const LeftPanel = React.createClass({
|
|||
this.focusedElement = null;
|
||||
|
||||
this._settingWatchRef = SettingsStore.watchSetting(
|
||||
"feature_room_breadcrumbs", null,
|
||||
this._onBreadcrumbsChanged);
|
||||
"feature_room_breadcrumbs", null, this._onBreadcrumbsChanged);
|
||||
|
||||
this.setState({breadcrumbs: SettingsStore.isFeatureEnabled("feature_room_breadcrumbs")});
|
||||
const useBreadcrumbs = SettingsStore.isFeatureEnabled("feature_room_breadcrumbs");
|
||||
Analytics.setBreadcrumbs(useBreadcrumbs);
|
||||
this.setState({breadcrumbs: useBreadcrumbs});
|
||||
},
|
||||
|
||||
componentWillUnmount: function() {
|
||||
|
@ -84,6 +86,10 @@ const LeftPanel = React.createClass({
|
|||
return false;
|
||||
},
|
||||
|
||||
componentDidUpdate(newProps, newState) {
|
||||
Analytics.setBreadcrumbs(newState.breadcrumbs);
|
||||
},
|
||||
|
||||
_onBreadcrumbsChanged: function(settingName, roomId, level, valueAtLevel, value) {
|
||||
// Features are only possible at a single level, so we can get away with using valueAtLevel.
|
||||
// The SettingsStore runs on the same tick as the update, so `value` will be wrong.
|
||||
|
|
|
@ -24,6 +24,7 @@ import classNames from 'classnames';
|
|||
import sdk from "../../../index";
|
||||
import * as RoomNotifs from '../../../RoomNotifs';
|
||||
import * as FormattingUtils from "../../../utils/FormattingUtils";
|
||||
import Analytics from "../../../Analytics";
|
||||
|
||||
const MAX_ROOMS = 20;
|
||||
|
||||
|
@ -175,7 +176,8 @@ export default class RoomBreadcrumbs extends React.Component {
|
|||
this.setState({rooms});
|
||||
}
|
||||
|
||||
_viewRoom(room) {
|
||||
_viewRoom(room, index) {
|
||||
Analytics.trackEvent("Breadcrumbs", "click_node", index);
|
||||
dis.dispatch({action: "view_room", room_id: room.roomId});
|
||||
}
|
||||
|
||||
|
@ -233,7 +235,7 @@ export default class RoomBreadcrumbs extends React.Component {
|
|||
}
|
||||
|
||||
return (
|
||||
<AccessibleButton className={classes} key={r.room.roomId} onClick={() => this._viewRoom(r.room)}
|
||||
<AccessibleButton className={classes} key={r.room.roomId} onClick={() => this._viewRoom(r.room, i)}
|
||||
onMouseEnter={() => this._onMouseEnter(r.room)} onMouseLeave={() => this._onMouseLeave(r.room)}>
|
||||
<RoomAvatar room={r.room} width={32} height={32} />
|
||||
{badge}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue