Skip to content

Commit 85a5b69

Browse files
committed
Track view of the assistant in the app
1 parent 6b2fa0d commit 85a5b69

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/gitbook/src/components/AIChat/AIChat.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
EmbeddableFrameSubtitle,
2121
EmbeddableFrameTitle,
2222
} from '../Embeddable/EmbeddableFrame';
23+
import { useTrackEvent } from '../Insights';
2324
import { useNow } from '../hooks';
2425
import { Button } from '../primitives';
2526
import { AIChatControlButton } from './AIChatControlButton';
@@ -54,6 +55,16 @@ export function AIChat(props: { trademark: boolean }) {
5455
[]
5556
);
5657

58+
// Track the view of the AI chat
59+
const trackEvent = useTrackEvent();
60+
React.useEffect(() => {
61+
if (chat.opened) {
62+
trackEvent({
63+
type: 'ask_view',
64+
});
65+
}
66+
}, [chat.opened, trackEvent]);
67+
5768
if (!chat.opened) {
5869
return null;
5970
}

0 commit comments

Comments
 (0)