Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: load tracker everywhere

thecodrr26bfd7ad7c69
diff --git a/apps/web/src/app-effects.js b/apps/web/src/app-effects.js
index d1df9e2a3..2f99ba126 100644
--- a/apps/web/src/app-effects.js
+++ b/apps/web/src/app-effects.js
@@ -26,11 +26,6 @@ import { updateStatus, removeStatus, getStatus } from "./hooks/use-status";
import { showToast } from "./utils/toast";
import { interruptedOnboarding } from "./components/dialogs/onboarding-dialog";
-if (process.env.NODE_ENV === "production") {
- loadTrackerScript();
- console.log = () => {};
-}
-
export default function AppEffects({ setShow }) {
const refreshNavItems = useStore((store) => store.refreshNavItems);
const sync = useStore((store) => store.sync);
diff --git a/apps/web/src/hooks/use-database.js b/apps/web/src/hooks/use-database.js
index da906cc3a..1267b8a3e 100644
--- a/apps/web/src/hooks/use-database.js
+++ b/apps/web/src/hooks/use-database.js
@@ -1,5 +1,11 @@
import { useEffect, useState } from "react";
import { initializeDatabase } from "../common/db";
+import { loadTrackerScript } from "../utils/analytics";
+
+if (process.env.NODE_ENV === "production") {
+ loadTrackerScript();
+ console.log = () => {};
+}
const memory = {
isAppLoaded: false,
diff --git a/apps/web/src/stores/user-store.js b/apps/web/src/stores/user-store.js
index c679ed9ca..44ffe7ec5 100644
--- a/apps/web/src/stores/user-store.js
+++ b/apps/web/src/stores/user-store.js
@@ -13,6 +13,7 @@ import { onPageVisibilityChanged } from "../utils/page-visibility";
import { hashNavigate } from "../navigation";
import { isUserPremium } from "../hooks/use-is-user-premium";
import { SUBSCRIPTION_STATUS } from "../common/constants";
+import { ANALYTICS_EVENTS, trackEvent } from "../utils/analytics";
class UserStore extends BaseStore {
isLoggedIn = false;
@@ -114,6 +115,7 @@ class UserStore extends BaseStore {
return db.user
.signup(form.email.toLowerCase(), form.password)
.then(() => {
+ trackEvent(ANALYTICS_EVENTS.accountCreated);
return this.init();
})
.finally(() => {
diff --git a/apps/web/src/views/auth.tsx b/apps/web/src/views/auth.tsx
index 128ec1334..d70a77c3c 100644
--- a/apps/web/src/views/auth.tsx
+++ b/apps/web/src/views/auth.tsx
@@ -277,7 +277,6 @@ function Signup(props: BaseAuthComponentProps<"signup">) {
}
await userstore.signup(form);
- trackEvent(ANALYTICS_EVENTS.accountCreated);
openURL("/notes/#/welcome");
}}
>