UNPKG

@shopana/ga

Version:

Type-safe Google Analytics 4 (GA4) tracking library for React and Next.js with ecommerce support, event batching, and SSR compatibility

17 lines 541 B
import { useContext } from 'react'; import { GAContext } from '../context'; export function useAnalyticsClient() { const context = useContext(GAContext); if (!context) { throw new Error('useAnalyticsClient must be used inside GAProvider'); } return context.client; } export function useGATracker() { const context = useContext(GAContext); if (!context) { throw new Error('useGATracker must be used inside GAProvider'); } return context.tracker; } //# sourceMappingURL=useAnalyticsClient.js.map