@@ -15,6 +15,7 @@ import {isAppleDevice, isWebKit} from "@react-aria/utils";
15
15
import { create } from "zustand" ;
16
16
import { isEmpty , intersectionBy } from "@nextui-org/shared-utils" ;
17
17
import { writeStorage , useLocalStorage } from "@rehooks/local-storage" ;
18
+ import { usePostHog } from "posthog-js/react" ;
18
19
19
20
import {
20
21
DocumentCodeBoldIcon ,
@@ -25,7 +26,6 @@ import {
25
26
26
27
import searchData from "@/config/search-meta.json" ;
27
28
import { useUpdateEffect } from "@/hooks/use-update-effect" ;
28
- import { trackEvent } from "@/utils/va" ;
29
29
30
30
const hideOnPaths = [ "examples" ] ;
31
31
@@ -139,6 +139,8 @@ export const Cmdk: FC<{}> = () => {
139
139
140
140
const { isOpen, onClose, onOpen} = useCmdkStore ( ) ;
141
141
142
+ const posthog = usePostHog ( ) ;
143
+
142
144
const [ recentSearches ] = useLocalStorage < SearchResultItem [ ] > ( RECENT_SEARCHES_KEY ) ;
143
145
144
146
const addToRecentSearches = ( item : SearchResultItem ) => {
@@ -196,7 +198,7 @@ export const Cmdk: FC<{}> = () => {
196
198
197
199
const matches = intersectionBy ( ...matchesForEachWord , "objectID" ) . slice ( 0 , MAX_RESULTS ) ;
198
200
199
- trackEvent ( "Cmdk - Search" , {
201
+ posthog . capture ( "Cmdk - Search" , {
200
202
name : "cmdk - search" ,
201
203
action : "search" ,
202
204
category : "cmdk" ,
@@ -219,7 +221,7 @@ export const Cmdk: FC<{}> = () => {
219
221
e . preventDefault ( ) ;
220
222
isOpen ? onClose ( ) : onOpen ( ) ;
221
223
222
- trackEvent ( "Cmdk - Open/Close" , {
224
+ posthog . capture ( "Cmdk - Open/Close" , {
223
225
name : "cmdk - open/close" ,
224
226
action : "keydown" ,
225
227
category : "cmdk" ,
@@ -241,7 +243,7 @@ export const Cmdk: FC<{}> = () => {
241
243
router . push ( item . url ) ;
242
244
addToRecentSearches ( item ) ;
243
245
244
- trackEvent ( "Cmdk - ItemSelect" , {
246
+ posthog . capture ( "Cmdk - ItemSelect" , {
245
247
name : item . content ,
246
248
action : "click" ,
247
249
category : "cmdk" ,
0 commit comments