track.ts 384 B

123456789101112
  1. import { useCallback } from "react";
  2. export function track(event: string, props?: Record<string, unknown>) {
  3. if (typeof window !== "undefined") {
  4. // Placeholder: send to briven analytics
  5. console.debug("[track]", event, props);
  6. }
  7. }
  8. export function useTrack() {
  9. return useCallback((event: string, props?: Record<string, unknown>) => {
  10. track(event, props);
  11. }, []);
  12. }