mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: log allowed events (#8224)
This commit is contained in:
parent
96eeec5119
commit
e52c2cd0b6
5 changed files with 16 additions and 12 deletions
|
@ -1,6 +1,6 @@
|
|||
// place here categories that you want to track. We want to track just a
|
||||
// small subset of categories at a given time.
|
||||
const ALLOWED_CATEGORIES_TO_TRACK = ["ai", "command_palette"] as string[];
|
||||
const ALLOWED_CATEGORIES_TO_TRACK = new Set(["command_palette"]);
|
||||
|
||||
export const trackEvent = (
|
||||
category: string,
|
||||
|
@ -9,17 +9,20 @@ export const trackEvent = (
|
|||
value?: number,
|
||||
) => {
|
||||
try {
|
||||
// prettier-ignore
|
||||
if (
|
||||
typeof window === "undefined"
|
||||
|| import.meta.env.VITE_WORKER_ID
|
||||
// comment out to debug locally
|
||||
|| import.meta.env.PROD
|
||||
typeof window === "undefined" ||
|
||||
import.meta.env.VITE_WORKER_ID ||
|
||||
import.meta.env.VITE_APP_ENABLE_TRACKING !== "true"
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ALLOWED_CATEGORIES_TO_TRACK.includes(category)) {
|
||||
if (!ALLOWED_CATEGORIES_TO_TRACK.has(category)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (import.meta.env.DEV) {
|
||||
// comment out to debug in dev
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
1
packages/excalidraw/vite-env.d.ts
vendored
1
packages/excalidraw/vite-env.d.ts
vendored
|
@ -43,6 +43,7 @@ interface ImportMetaEnv {
|
|||
VITE_APP_COLLAPSE_OVERLAY: string;
|
||||
// Enable eslint in dev server
|
||||
VITE_APP_ENABLE_ESLINT: string;
|
||||
VITE_APP_ENABLE_TRACKING: string;
|
||||
|
||||
VITE_PKG_NAME: string;
|
||||
VITE_PKG_VERSION: string;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue