mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-04 00:18:01 +01:00
Adds tracking to maintenance feature (#2723)
Adds tracking with plausible to maintenance feature
This commit is contained in:
parent
5b66346e56
commit
e533b44c5b
@ -10,6 +10,7 @@ import {
|
||||
} from '@mui/material';
|
||||
import { useMaintenance } from 'hooks/api/getters/useMaintenance/useMaintenance';
|
||||
import { useMaintenanceApi } from 'hooks/api/actions/useMaintenanceApi/useMaintenanceApi';
|
||||
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
|
||||
|
||||
const StyledCard = styled(Card)(({ theme }) => ({
|
||||
display: 'flex',
|
||||
@ -38,7 +39,13 @@ const SwitchLabel = styled(Typography)(({ theme }) => ({
|
||||
export const MaintenanceToggle = () => {
|
||||
const { enabled, refetchMaintenance } = useMaintenance();
|
||||
const { toggleMaintenance } = useMaintenanceApi();
|
||||
const { trackEvent } = usePlausibleTracker();
|
||||
const updateEnabled = async () => {
|
||||
trackEvent('maintenance', {
|
||||
props: {
|
||||
eventType: `maintenance ${enabled ? 'de' : ''}activated`,
|
||||
},
|
||||
});
|
||||
await toggleMaintenance({ enabled: !enabled });
|
||||
refetchMaintenance();
|
||||
};
|
||||
|
@ -12,7 +12,8 @@ type CustomEvents =
|
||||
| 'invite'
|
||||
| 'upgrade_plan_clicked'
|
||||
| 'change_request'
|
||||
| 'favorite';
|
||||
| 'favorite'
|
||||
| 'maintenance';
|
||||
|
||||
export const usePlausibleTracker = () => {
|
||||
const plausible = useContext(PlausibleContext);
|
||||
|
Loading…
Reference in New Issue
Block a user