/**
 * Send a custom event to Google Analytics 4.
 * Safe to call anywhere — silently no-ops if gtag isn't loaded.
 */
export function trackEvent(
  eventName: string,
  params?: Record<string, string | number | boolean>,
) {
  if (typeof window !== 'undefined' && typeof window.gtag === 'function') {
    window.gtag('event', eventName, params)
  }
}
