Skip to content

Commit

Permalink
chore(docs): env var added to enable/disable va tracking events
Browse files Browse the repository at this point in the history
  • Loading branch information
jrgarciadev committed Dec 26, 2023
1 parent 132efbc commit 921746f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions apps/docs/utils/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export const __PROD__ = process.env.NODE_ENV === "production";
export const __DEV__ = process.env.NODE_ENV !== "production";
export const __TEST__ = process.env.NODE_ENV === "test";
export const __PREVIEW__ = process.env.IS_PREVIEW === "true";
export const __IS_VA_ENABLED__ = process.env.IS_VA_ENABLED === "true";
4 changes: 2 additions & 2 deletions apps/docs/utils/va.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import va from "@vercel/analytics";

import {__PROD__} from "./env";
import {__PROD__, __IS_VA_ENABLED__} from "./env";

export function getUniqueID(prefix: string) {
return `${prefix}-${new Date().getTime()}`;
Expand All @@ -27,7 +27,7 @@ const getSessionId = () => {
};

export const trackEvent = (label: string, event: TrackEvent) => {
if (!__PROD__) return;
if (!__PROD__ || !__IS_VA_ENABLED__) return;

const sessionId = getSessionId();

Expand Down

0 comments on commit 921746f

Please sign in to comment.