Add posthog tracking for key backup toasts (#31195)
* Add tracking for setting up key backups. * fix lint * Update @matrix-org/analytics-events to 0.30.0
This commit is contained in:
@@ -87,7 +87,7 @@
|
|||||||
"@fontsource/inconsolata": "^5",
|
"@fontsource/inconsolata": "^5",
|
||||||
"@fontsource/inter": "^5",
|
"@fontsource/inter": "^5",
|
||||||
"@formatjs/intl-segmenter": "^11.5.7",
|
"@formatjs/intl-segmenter": "^11.5.7",
|
||||||
"@matrix-org/analytics-events": "^0.29.2",
|
"@matrix-org/analytics-events": "^0.30.0",
|
||||||
"@matrix-org/emojibase-bindings": "^1.3.4",
|
"@matrix-org/emojibase-bindings": "^1.3.4",
|
||||||
"@matrix-org/react-sdk-module-api": "^2.4.0",
|
"@matrix-org/react-sdk-module-api": "^2.4.0",
|
||||||
"@matrix-org/spec": "^1.7.0",
|
"@matrix-org/spec": "^1.7.0",
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ Please see LICENSE files in the repository root for full details.
|
|||||||
|
|
||||||
import KeyIcon from "@vector-im/compound-design-tokens/assets/web/icons/key";
|
import KeyIcon from "@vector-im/compound-design-tokens/assets/web/icons/key";
|
||||||
import { type ComponentType } from "react";
|
import { type ComponentType } from "react";
|
||||||
|
import { type Interaction as InteractionEvent } from "@matrix-org/analytics-events/types/typescript/Interaction";
|
||||||
|
|
||||||
import type React from "react";
|
import type React from "react";
|
||||||
import Modal from "../Modal";
|
import Modal from "../Modal";
|
||||||
@@ -25,6 +26,7 @@ import { Action } from "../dispatcher/actions";
|
|||||||
import { UserTab } from "../components/views/dialogs/UserTab";
|
import { UserTab } from "../components/views/dialogs/UserTab";
|
||||||
import defaultDispatcher from "../dispatcher/dispatcher";
|
import defaultDispatcher from "../dispatcher/dispatcher";
|
||||||
import ConfirmKeyStorageOffDialog from "../components/views/dialogs/ConfirmKeyStorageOffDialog";
|
import ConfirmKeyStorageOffDialog from "../components/views/dialogs/ConfirmKeyStorageOffDialog";
|
||||||
|
import { PosthogAnalytics } from "../PosthogAnalytics";
|
||||||
|
|
||||||
const TOAST_KEY = "setupencryption";
|
const TOAST_KEY = "setupencryption";
|
||||||
|
|
||||||
@@ -156,6 +158,11 @@ export const showToast = (kind: Kind): void => {
|
|||||||
switch (kind) {
|
switch (kind) {
|
||||||
case Kind.SET_UP_RECOVERY:
|
case Kind.SET_UP_RECOVERY:
|
||||||
case Kind.TURN_ON_KEY_STORAGE: {
|
case Kind.TURN_ON_KEY_STORAGE: {
|
||||||
|
PosthogAnalytics.instance.trackEvent<InteractionEvent>({
|
||||||
|
eventName: "Interaction",
|
||||||
|
interactionType: "Pointer",
|
||||||
|
name: kind === Kind.SET_UP_RECOVERY ? "ToastSetUpRecoveryClick" : "ToastTurnOnKeyStorageClick",
|
||||||
|
});
|
||||||
// Open the user settings dialog to the encryption tab
|
// Open the user settings dialog to the encryption tab
|
||||||
const payload: OpenToTabPayload = {
|
const payload: OpenToTabPayload = {
|
||||||
action: Action.ViewUserSettings,
|
action: Action.ViewUserSettings,
|
||||||
@@ -191,6 +198,11 @@ export const showToast = (kind: Kind): void => {
|
|||||||
const onSecondaryClick = async (): Promise<void> => {
|
const onSecondaryClick = async (): Promise<void> => {
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case Kind.SET_UP_RECOVERY: {
|
case Kind.SET_UP_RECOVERY: {
|
||||||
|
PosthogAnalytics.instance.trackEvent<InteractionEvent>({
|
||||||
|
eventName: "Interaction",
|
||||||
|
interactionType: "Pointer",
|
||||||
|
name: "ToastSetUpRecoveryDismiss",
|
||||||
|
});
|
||||||
// Record that the user doesn't want to set up recovery
|
// Record that the user doesn't want to set up recovery
|
||||||
const deviceListener = DeviceListener.sharedInstance();
|
const deviceListener = DeviceListener.sharedInstance();
|
||||||
await deviceListener.recordRecoveryDisabled();
|
await deviceListener.recordRecoveryDisabled();
|
||||||
@@ -209,6 +221,11 @@ export const showToast = (kind: Kind): void => {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Kind.TURN_ON_KEY_STORAGE: {
|
case Kind.TURN_ON_KEY_STORAGE: {
|
||||||
|
PosthogAnalytics.instance.trackEvent<InteractionEvent>({
|
||||||
|
eventName: "Interaction",
|
||||||
|
interactionType: "Pointer",
|
||||||
|
name: "ToastTurnOnKeyStorageDismiss",
|
||||||
|
});
|
||||||
// The user clicked "Dismiss": offer them "Are you sure?"
|
// The user clicked "Dismiss": offer them "Are you sure?"
|
||||||
const modal = Modal.createDialog(
|
const modal = Modal.createDialog(
|
||||||
ConfirmKeyStorageOffDialog,
|
ConfirmKeyStorageOffDialog,
|
||||||
|
|||||||
19
yarn.lock
19
yarn.lock
@@ -1586,15 +1586,8 @@
|
|||||||
yaml "^2.7.0"
|
yaml "^2.7.0"
|
||||||
|
|
||||||
"@element-hq/web-shared-components@link:packages/shared-components":
|
"@element-hq/web-shared-components@link:packages/shared-components":
|
||||||
version "0.0.0-test.7"
|
version "0.0.0"
|
||||||
dependencies:
|
uid ""
|
||||||
classnames "^2.5.1"
|
|
||||||
counterpart "^0.18.6"
|
|
||||||
lodash "^4.17.21"
|
|
||||||
matrix-web-i18n "^3.4.0"
|
|
||||||
patch-package "^8.0.1"
|
|
||||||
react-merge-refs "^3.0.2"
|
|
||||||
temporal-polyfill "^0.3.0"
|
|
||||||
|
|
||||||
"@emnapi/core@^1.4.3":
|
"@emnapi/core@^1.4.3":
|
||||||
version "1.7.0"
|
version "1.7.0"
|
||||||
@@ -2407,10 +2400,10 @@
|
|||||||
pbf "^4.0.1"
|
pbf "^4.0.1"
|
||||||
supercluster "^8.0.1"
|
supercluster "^8.0.1"
|
||||||
|
|
||||||
"@matrix-org/analytics-events@^0.29.2":
|
"@matrix-org/analytics-events@^0.30.0":
|
||||||
version "0.29.2"
|
version "0.30.0"
|
||||||
resolved "https://registry.yarnpkg.com/@matrix-org/analytics-events/-/analytics-events-0.29.2.tgz#20d9877f11d5e411f1610f396f9e490673d6da50"
|
resolved "https://registry.yarnpkg.com/@matrix-org/analytics-events/-/analytics-events-0.30.0.tgz#67e87e56518fec5330978bf1fcc8d7bb66cdd9d1"
|
||||||
integrity sha512-kpCdf6DBxgE7MbBbYr7FvahrktHHtiph3QN10I6nBAAPQ+hmR3aZHBECxjxLQ9RxvtBF9nlKK4bgy2YrNp6j3A==
|
integrity sha512-RYIgYdYIvJoTzWaTeqskNGYt6w+6wKP43xMcfpdTKhDm/o2s4keuzRnRG9Qkfg10/3dGOjYCPfH78cXPKDzxeg==
|
||||||
|
|
||||||
"@matrix-org/emojibase-bindings@^1.3.4":
|
"@matrix-org/emojibase-bindings@^1.3.4":
|
||||||
version "1.3.4"
|
version "1.3.4"
|
||||||
|
|||||||
Reference in New Issue
Block a user