mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-22 01:16:07 +02:00
feat: track complete event (#7047)
This commit is contained in:
parent
20c3ef30f3
commit
56f2dd658e
@ -6,6 +6,7 @@ import useFeatureLifecycleApi from 'hooks/api/actions/useFeatureLifecycleApi/use
|
|||||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||||
import { SingleVariantOptions } from './SingleVariantOptions';
|
import { SingleVariantOptions } from './SingleVariantOptions';
|
||||||
import { useParentVariantOptions } from 'hooks/api/getters/useFeatureDependencyOptions/useFeatureDependencyOptions';
|
import { useParentVariantOptions } from 'hooks/api/getters/useFeatureDependencyOptions/useFeatureDependencyOptions';
|
||||||
|
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
|
||||||
|
|
||||||
interface IMarkCompletedDialogueProps {
|
interface IMarkCompletedDialogueProps {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
@ -31,6 +32,9 @@ export const MarkCompletedDialogue = ({
|
|||||||
);
|
);
|
||||||
const [status, setStatus] = useState<Status>('kept');
|
const [status, setStatus] = useState<Status>('kept');
|
||||||
const [variant, setVariant] = useState<string | undefined>(undefined);
|
const [variant, setVariant] = useState<string | undefined>(undefined);
|
||||||
|
|
||||||
|
const { trackEvent } = usePlausibleTracker();
|
||||||
|
|
||||||
const onClick = async () => {
|
const onClick = async () => {
|
||||||
const sentStatus = status === 'kept-with-variant' ? 'kept' : status;
|
const sentStatus = status === 'kept-with-variant' ? 'kept' : status;
|
||||||
await markFeatureCompleted(featureId, projectId, {
|
await markFeatureCompleted(featureId, projectId, {
|
||||||
@ -39,6 +43,12 @@ export const MarkCompletedDialogue = ({
|
|||||||
});
|
});
|
||||||
setIsOpen(false);
|
setIsOpen(false);
|
||||||
onComplete();
|
onComplete();
|
||||||
|
trackEvent('feature-lifecycle', {
|
||||||
|
props: {
|
||||||
|
eventType: 'complete',
|
||||||
|
status: sentStatus,
|
||||||
|
},
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -60,7 +60,8 @@ export type CustomEvents =
|
|||||||
| 'sdk-reporting'
|
| 'sdk-reporting'
|
||||||
| 'insights-share'
|
| 'insights-share'
|
||||||
| 'many-strategies'
|
| 'many-strategies'
|
||||||
| 'sdk-banner';
|
| 'sdk-banner'
|
||||||
|
| 'feature-lifecycle';
|
||||||
|
|
||||||
export const usePlausibleTracker = () => {
|
export const usePlausibleTracker = () => {
|
||||||
const plausible = useContext(PlausibleContext);
|
const plausible = useContext(PlausibleContext);
|
||||||
|
Loading…
Reference in New Issue
Block a user