useAnalytics

The useAnalytics hook is designed to facilitate custom analytics integration within your application. It allows you to set a custom analytics provider and provides a trackEvent function that can be used to track crucial events in your custom components.

Hook Type definition: useAnalytics

Example usage
const { getAnalyticsProvider, setAnalyticsProvider, trackEvent  } = useAnalytics();

Hook Return Value

getAnalyticsProvider

A function to get custom analytics provider.

Type
Function of type: () => IAnalyticsProvider

setAnalyticsProvider

A function to set a custom analytics provider dynamically

Type
Function of type: (provider: IAnalyticsProvider) => void

trackEvent

A function that allows you to track custom events.

Type
Function of type: (event: string, trackObj: unknown) => void