(
href="https://blog.excalidraw.com"
target="_blank"
rel="noopener noreferrer"
- onClick={() => {
- trackEvent(EVENT_EXIT, "blog");
- }}
>
{t("shortcutsDialog.blog")}
@@ -102,9 +98,6 @@ const Footer = () => (
href="https://howto.excalidraw.com"
target="_blank"
rel="noopener noreferrer"
- onClick={() => {
- trackEvent(EVENT_EXIT, "guides");
- }}
>
{t("shortcutsDialog.howto")}
@@ -112,9 +105,6 @@ const Footer = () => (
href="https://github.com/excalidraw/excalidraw/issues"
target="_blank"
rel="noopener noreferrer"
- onClick={() => {
- trackEvent(EVENT_EXIT, "issues");
- }}
>
{t("shortcutsDialog.github")}
diff --git a/src/data/blob.ts b/src/data/blob.ts
index e73b367b..1ecc9df7 100644
--- a/src/data/blob.ts
+++ b/src/data/blob.ts
@@ -1,4 +1,3 @@
-import { EVENT_IO, trackEvent } from "../analytics";
import { cleanAppStateForExport } from "../appState";
import { MIME_TYPES } from "../constants";
import { clearElementsForExport } from "../element";
@@ -111,7 +110,6 @@ export const loadFromBlob = async (
localAppState,
);
- trackEvent(EVENT_IO, "load", getMimeType(blob));
return result;
} catch (error) {
console.error(error.message);
diff --git a/src/data/index.ts b/src/data/index.ts
index 6797a7a3..41de22a4 100644
--- a/src/data/index.ts
+++ b/src/data/index.ts
@@ -1,5 +1,4 @@
import { fileSave } from "browser-nativefs";
-import { EVENT_IO, trackEvent } from "../analytics";
import {
copyCanvasToClipboardAsPng,
copyTextToSystemClipboard,
@@ -8,8 +7,8 @@ import { NonDeletedExcalidrawElement } from "../element/types";
import { t } from "../i18n";
import { exportToCanvas, exportToSvg } from "../scene/export";
import { ExportType } from "../scene/types";
-import { canvasToBlob } from "./blob";
import { AppState } from "../types";
+import { canvasToBlob } from "./blob";
import { serializeAsJSON } from "./json";
export { loadFromBlob } from "./blob";
@@ -60,10 +59,8 @@ export const exportCanvas = async (
fileName: `${name}.svg`,
extensions: [".svg"],
});
- trackEvent(EVENT_IO, "export", "svg");
return;
} else if (type === "clipboard-svg") {
- trackEvent(EVENT_IO, "export", "clipboard-svg");
copyTextToSystemClipboard(tempSvg.outerHTML);
return;
}
@@ -95,11 +92,9 @@ export const exportCanvas = async (
fileName,
extensions: [".png"],
});
- trackEvent(EVENT_IO, "export", "png");
} else if (type === "clipboard") {
try {
await copyCanvasToClipboardAsPng(tempCanvas);
- trackEvent(EVENT_IO, "export", "clipboard-png");
} catch (error) {
if (error.name === "CANVAS_POSSIBLY_TOO_BIG") {
throw error;
diff --git a/src/data/json.ts b/src/data/json.ts
index 67e969be..d4d3205a 100644
--- a/src/data/json.ts
+++ b/src/data/json.ts
@@ -1,13 +1,11 @@
-import { ExcalidrawElement } from "../element/types";
-import { AppState } from "../types";
-import { cleanAppStateForExport } from "../appState";
-
import { fileOpen, fileSave } from "browser-nativefs";
-import { loadFromBlob } from "./blob";
-import { Library } from "./library";
+import { cleanAppStateForExport } from "../appState";
import { MIME_TYPES } from "../constants";
import { clearElementsForExport } from "../element";
-import { EVENT_LIBRARY, trackEvent } from "../analytics";
+import { ExcalidrawElement } from "../element/types";
+import { AppState } from "../types";
+import { loadFromBlob } from "./blob";
+import { Library } from "./library";
export const serializeAsJSON = (
elements: readonly ExcalidrawElement[],
@@ -84,7 +82,6 @@ export const saveLibraryAsJSON = async () => {
description: "Excalidraw library file",
extensions: [".excalidrawlib"],
});
- trackEvent(EVENT_LIBRARY, "save");
};
export const importLibraryFromJSON = async () => {
@@ -93,6 +90,5 @@ export const importLibraryFromJSON = async () => {
extensions: [".json", ".excalidrawlib"],
mimeTypes: ["application/json"],
});
- trackEvent(EVENT_LIBRARY, "load");
Library.importLibrary(blob);
};
diff --git a/src/excalidraw-app/collab/CollabWrapper.tsx b/src/excalidraw-app/collab/CollabWrapper.tsx
index 9e46a630..d27adb35 100644
--- a/src/excalidraw-app/collab/CollabWrapper.tsx
+++ b/src/excalidraw-app/collab/CollabWrapper.tsx
@@ -1,40 +1,36 @@
-import React, { PureComponent } from "react";
import throttle from "lodash.throttle";
-
+import React, { PureComponent } from "react";
+import { ExcalidrawImperativeAPI } from "../../components/App";
+import { ErrorDialog } from "../../components/ErrorDialog";
import { APP_NAME, ENV, EVENT } from "../../constants";
-
-import {
- decryptAESGEM,
- SocketUpdateDataSource,
- getCollaborationLinkData,
- generateCollaborationLink,
- SOCKET_SERVER,
-} from "../data";
-import { isSavedToFirebase, saveToFirebase } from "../data/firebase";
-
-import Portal from "./Portal";
-import { AppState, Collaborator, Gesture } from "../../types";
+import { ImportedDataState } from "../../data/types";
import { ExcalidrawElement } from "../../element/types";
-import {
- importUsernameFromLocalStorage,
- saveUsernameToLocalStorage,
- STORAGE_KEYS,
-} from "../data/localStorage";
-import { resolvablePromise, withBatchedUpdates } from "../../utils";
import {
getSceneVersion,
getSyncableElements,
} from "../../packages/excalidraw/index";
-import RoomDialog from "./RoomDialog";
-import { ErrorDialog } from "../../components/ErrorDialog";
-import { ImportedDataState } from "../../data/types";
-import { ExcalidrawImperativeAPI } from "../../components/App";
+import { AppState, Collaborator, Gesture } from "../../types";
+import { resolvablePromise, withBatchedUpdates } from "../../utils";
import {
INITIAL_SCENE_UPDATE_TIMEOUT,
SCENE,
SYNC_FULL_SCENE_INTERVAL_MS,
} from "../app_constants";
-import { EVENT_SHARE, trackEvent } from "../../analytics";
+import {
+ decryptAESGEM,
+ generateCollaborationLink,
+ getCollaborationLinkData,
+ SocketUpdateDataSource,
+ SOCKET_SERVER,
+} from "../data";
+import { isSavedToFirebase, saveToFirebase } from "../data/firebase";
+import {
+ importUsernameFromLocalStorage,
+ saveUsernameToLocalStorage,
+ STORAGE_KEYS,
+} from "../data/localStorage";
+import Portal from "./Portal";
+import RoomDialog from "./RoomDialog";
interface CollabState {
isCollaborating: boolean;
@@ -168,7 +164,6 @@ class CollabWrapper extends PureComponent
{
elements,
commitToHistory: true,
});
- trackEvent(EVENT_SHARE, "session start");
return this.initializeSocketClient();
};
@@ -176,7 +171,6 @@ class CollabWrapper extends PureComponent {
this.saveCollabRoomToFirebase();
window.history.pushState({}, APP_NAME, window.location.origin);
this.destroySocketClient();
- trackEvent(EVENT_SHARE, "session end");
};
private destroySocketClient = () => {
diff --git a/src/excalidraw-app/collab/RoomDialog.tsx b/src/excalidraw-app/collab/RoomDialog.tsx
index fdf62f1c..c880eece 100644
--- a/src/excalidraw-app/collab/RoomDialog.tsx
+++ b/src/excalidraw-app/collab/RoomDialog.tsx
@@ -1,12 +1,10 @@
import React, { useRef } from "react";
-import { t } from "../../i18n";
-import { Dialog } from "../../components/Dialog";
import { copyTextToSystemClipboard } from "../../clipboard";
-import { ToolButton } from "../../components/ToolButton";
+import { Dialog } from "../../components/Dialog";
import { clipboard, start, stop } from "../../components/icons";
-
+import { ToolButton } from "../../components/ToolButton";
+import { t } from "../../i18n";
import "./RoomDialog.scss";
-import { EVENT_SHARE, trackEvent } from "../../analytics";
const RoomDialog = ({
handleClose,
@@ -30,7 +28,6 @@ const RoomDialog = ({
const copyRoomLink = async () => {
try {
await copyTextToSystemClipboard(activeRoomLink);
- trackEvent(EVENT_SHARE, "copy link");
} catch (error) {
setErrorMessage(error.message);
}
@@ -95,7 +92,6 @@ const RoomDialog = ({
value={username || ""}
className="RoomDialog-username TextInput"
onChange={(event) => onUsernameChange(event.target.value)}
- onBlur={() => trackEvent(EVENT_SHARE, "name")}
onKeyPress={(event) => event.key === "Enter" && handleClose()}
/>
diff --git a/src/excalidraw-app/data/index.ts b/src/excalidraw-app/data/index.ts
index 0eb52fd8..9ec7b257 100644
--- a/src/excalidraw-app/data/index.ts
+++ b/src/excalidraw-app/data/index.ts
@@ -1,10 +1,9 @@
-import { t } from "../../i18n";
-import { ExcalidrawElement } from "../../element/types";
-import { AppState } from "../../types";
-import { ImportedDataState } from "../../data/types";
-import { restore } from "../../data/restore";
-import { EVENT_ACTION, EVENT_IO, trackEvent } from "../../analytics";
import { serializeAsJSON } from "../../data/json";
+import { restore } from "../../data/restore";
+import { ImportedDataState } from "../../data/types";
+import { ExcalidrawElement } from "../../element/types";
+import { t } from "../../i18n";
+import { AppState } from "../../types";
const byteToHex = (byte: number): string => `0${byte.toString(16)}`.slice(-2);
@@ -192,7 +191,6 @@ const importFromBackend = async (
data = await response.json();
}
- trackEvent(EVENT_ACTION, "import");
return {
elements: data.elements || null,
appState: data.appState || null,
@@ -276,7 +274,6 @@ export const exportToBackend = async (
url.hash = `json=${json.id},${exportedKey.k!}`;
const urlString = url.toString();
window.prompt(`🔒${t("alerts.uploadedSecurly")}`, urlString);
- trackEvent(EVENT_IO, "export", "backend");
} else if (json.error_class === "RequestTooLargeError") {
window.alert(t("alerts.couldNotCreateShareableLinkTooBig"));
} else {
diff --git a/src/excalidraw-app/index.tsx b/src/excalidraw-app/index.tsx
index fbc7eff2..4af6a242 100644
--- a/src/excalidraw-app/index.tsx
+++ b/src/excalidraw-app/index.tsx
@@ -1,45 +1,38 @@
-import React, {
- useState,
- useLayoutEffect,
- useEffect,
- useRef,
- useCallback,
-} from "react";
import LanguageDetector from "i18next-browser-languagedetector";
-
-import Excalidraw, {
- languages,
- defaultLang,
-} from "../packages/excalidraw/index";
-
-import {
- getTotalStorageSize,
- importFromLocalStorage,
- saveToLocalStorage,
- STORAGE_KEYS,
-} from "./data/localStorage";
-
-import { ImportedDataState } from "../data/types";
-import CollabWrapper, { CollabAPI } from "./collab/CollabWrapper";
-import { TopErrorBoundary } from "../components/TopErrorBoundary";
-import { Language, t } from "../i18n";
-import { exportToBackend, loadScene } from "./data";
-import { getCollaborationLinkData } from "./data";
-import { EVENT } from "../constants";
-import { loadFromFirebase } from "./data/firebase";
+import React, {
+ useCallback,
+ useEffect,
+ useLayoutEffect,
+ useRef,
+ useState,
+} from "react";
+import { getDefaultAppState } from "../appState";
import { ExcalidrawImperativeAPI } from "../components/App";
-import { debounce, ResolvablePromise, resolvablePromise } from "../utils";
-import { AppState, ExcalidrawAPIRefValue } from "../types";
+import { ErrorDialog } from "../components/ErrorDialog";
+import { TopErrorBoundary } from "../components/TopErrorBoundary";
+import { APP_NAME, EVENT, TITLE_TIMEOUT } from "../constants";
+import { ImportedDataState } from "../data/types";
import {
ExcalidrawElement,
NonDeletedExcalidrawElement,
} from "../element/types";
+import { Language, t } from "../i18n";
+import Excalidraw, {
+ defaultLang,
+ languages,
+} from "../packages/excalidraw/index";
+import { AppState, ExcalidrawAPIRefValue } from "../types";
+import { debounce, ResolvablePromise, resolvablePromise } from "../utils";
import { SAVE_TO_LOCAL_STORAGE_TIMEOUT } from "./app_constants";
-import { EVENT_LOAD, EVENT_SHARE, trackEvent } from "../analytics";
-import { ErrorDialog } from "../components/ErrorDialog";
-import { getDefaultAppState } from "../appState";
-import { APP_NAME, TITLE_TIMEOUT } from "../constants";
+import CollabWrapper, { CollabAPI } from "./collab/CollabWrapper";
import { LanguageList } from "./components/LanguageList";
+import { exportToBackend, getCollaborationLinkData, loadScene } from "./data";
+import { loadFromFirebase } from "./data/firebase";
+import {
+ importFromLocalStorage,
+ saveToLocalStorage,
+ STORAGE_KEYS,
+} from "./data/localStorage";
const languageDetector = new LanguageDetector();
languageDetector.init({
@@ -163,7 +156,6 @@ const initializeScene = async (opts: {
// into the remote scene
opts.resetScene();
const scenePromise = opts.initializeSocketClient();
- trackEvent(EVENT_SHARE, "session join");
try {
const [, roomId, roomKey] = getCollaborationLinkData(
@@ -231,12 +223,6 @@ function ExcalidrawWrapper(props: { collab: CollabAPI }) {
const { collab } = props;
useEffect(() => {
- const storageSize = getTotalStorageSize();
- if (storageSize) {
- trackEvent(EVENT_LOAD, "storage", "size", storageSize);
- } else {
- trackEvent(EVENT_LOAD, "first time");
- }
excalidrawRef.current!.readyPromise.then((excalidrawApi) => {
initializeScene({
resetScene: excalidrawApi.resetScene,
diff --git a/src/i18n.ts b/src/i18n.ts
index f2f837b2..fe90091b 100644
--- a/src/i18n.ts
+++ b/src/i18n.ts
@@ -1,5 +1,3 @@
-import { EVENT_CHANGE, trackEvent } from "./analytics";
-
import fallbackLangData from "./locales/en.json";
import percentages from "./locales/percentages.json";
@@ -67,7 +65,6 @@ export const setLanguage = async (lang: Language) => {
currentLangData = await import(
/* webpackChunkName: "i18n-[request]" */ `./locales/${currentLang.code}.json`
);
- trackEvent(EVENT_CHANGE, "language", currentLang.code);
};
export const setLanguageFirstTime = async (lang: Language) => {
diff --git a/src/zindex.ts b/src/zindex.ts
index 38ab9c8c..05571410 100644
--- a/src/zindex.ts
+++ b/src/zindex.ts
@@ -1,8 +1,7 @@
-import { AppState } from "./types";
import { ExcalidrawElement } from "./element/types";
import { getElementsInGroup } from "./groups";
-import { findLastIndex, findIndex } from "./utils";
-import { trackEvent, EVENT_LAYER } from "./analytics";
+import { AppState } from "./types";
+import { findIndex, findLastIndex } from "./utils";
/**
* Returns indices of elements to move based on selected elements.
@@ -176,7 +175,6 @@ const shiftElements = (
];
});
- trackEvent(EVENT_LAYER, "move", direction === "left" ? "down" : "up");
return elements;
};
@@ -234,7 +232,6 @@ const shiftElementsToEnd = (
const leadingElements = elements.slice(0, leadingIndex);
const trailingElements = elements.slice(trailingIndex + 1);
- trackEvent(EVENT_LAYER, "move", direction === "left" ? "back" : "front");
return direction === "left"
? [
...leadingElements,