Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

642 B
Raw Blame
export type AnalyticsEvent =
  | "Signup"
  | "Workspace Created"
  | "First Task"
  | "Invite Sent"
  | "Checkout Started"
  | "Subscribed";

export type TrackOptions = {
  props?: Record<string, string | number | boolean>;
};

declare global {
  interface Window {
    plausible?: (event: string, options?: TrackOptions) => void;
  }
}

export function isTrackingEnabled() {
  return (
    typeof window !== "undefined" && typeof window.plausible === "function"
  );
}

export function track(event: AnalyticsEvent, options?: TrackOptions) {
  if (!isTrackingEnabled()) return;
  try {
    window.plausible?.(event, options);
  } catch {}
}