Add telemetry to frontend

This commit is contained in:
Vladyslav Matsiiako
2022-11-25 16:08:56 -05:00
parent d70d1f23d8
commit 22e7137e74
7 changed files with 35 additions and 14 deletions
@@ -6,6 +6,7 @@ import { initPostHog } from "../analytics/posthog";
import getOrganizations from "../../pages/api/organization/getOrgs";
import getOrganizationUserProjects from "../../pages/api/organization/GetOrgUserProjects";
import SecurityClient from "./SecurityClient";
import { ENV } from "./config";
const nacl = require("tweetnacl");
nacl.util = require("tweetnacl-util");
@@ -154,7 +155,7 @@ const attemptLogin = async (
}
try {
if (email) {
if (process.env.NEXT_PUBLIC_ENV == "production") {
if (ENV == "production") {
const posthog = initPostHog();
posthog.identify(email);
posthog.capture("User Logged In");