"use client";

import { AnalyticsProvider } from "@/providers/analytics/AnalyticsProvider";

export function useAnalytics() {
  return window.gtag ? window.gtag : () => undefined;
}

export function trackEvent(event: string, params?: Record<string, any>) {
  if (typeof window === "undefined") return;
  if ((window as any).gtag) {
    (window as any).gtag("event", event, params ?? {});
  }
  if ((window as any).amplitude) {
    (window as any).amplitude.getInstance().logEvent(event, params);
  }
}
