We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6b2fa0d commit 85a5b69Copy full SHA for 85a5b69
packages/gitbook/src/components/AIChat/AIChat.tsx
@@ -20,6 +20,7 @@ import {
20
EmbeddableFrameSubtitle,
21
EmbeddableFrameTitle,
22
} from '../Embeddable/EmbeddableFrame';
23
+import { useTrackEvent } from '../Insights';
24
import { useNow } from '../hooks';
25
import { Button } from '../primitives';
26
import { AIChatControlButton } from './AIChatControlButton';
@@ -54,6 +55,16 @@ export function AIChat(props: { trademark: boolean }) {
54
55
[]
56
);
57
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
+
68
if (!chat.opened) {
69
return null;
70
}
0 commit comments