1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-19 21:39:40 +02:00
portainer/app/react/hooks/useAnalytics.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
464 B
TypeScript
Raw Permalink Normal View History

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);
}
}
}