Added event tracking for feature toggles (#20335)

no issue
This commit is contained in:
Kevin Ansfield 2024-06-05 17:59:03 +01:00 committed by GitHub
parent bb43395a2d
commit 0470a4a431
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,5 @@
import React from 'react';
import trackEvent from '../../../../utils/analytics';
import {ConfigResponseType, configDataType} from '@tryghost/admin-x-framework/api/config';
import {Toggle} from '@tryghost/admin-x-design-system';
import {getSettingValue, useEditSettings} from '@tryghost/admin-x-framework/api/settings';
@ -20,6 +21,7 @@ const FeatureToggle: React.FC<{ flag: string; label?: string; }> = ({label, flag
key: 'labs',
value: JSON.stringify({...labs, [flag]: newValue})
}]);
trackEvent('Feature Toggled', {state: newValue ? 'on' : 'off', feature: flag});
client.setQueriesData([configDataType], current => ({
config: {
...(current as ConfigResponseType).config,