mirror of https://github.com/portainer/portainer
17 lines
464 B
TypeScript
17 lines
464 B
TypeScript
import { trackEvent } from '@/angulartics.matomo/analytics-services';
|
|
import { usePublicSettings } from '@/react/portainer/settings/queries';
|
|
|
|
export function useAnalytics() {
|
|
const telemetryQuery = usePublicSettings({
|
|
select: (settings) => settings.EnableTelemetry,
|
|
});
|
|
|
|
return { trackEvent: handleTrackEvent };
|
|
|
|
function handleTrackEvent(...args: Parameters<typeof trackEvent>) {
|
|
if (telemetryQuery.data) {
|
|
trackEvent(...args);
|
|
}
|
|
}
|
|
}
|