File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -48,8 +48,8 @@ const reload = () => {
4848}
4949
5050const leave = ( to : RouteLocationNormalized , from : RouteLocationNormalized ) => {
51- if ( from . path !== to . path && typeof window !== "undefined" && window . posthog !== undefined ) {
52- window . posthog . capture ( ' $pageleave' ) ;
51+ if ( from . path !== to . path && typeof window !== "undefined" && window . analytics !== undefined ) {
52+ window . analytics . track ( { event : " $pageleave" } ) ;
5353 }
5454}
5555
@@ -110,6 +110,7 @@ export default defineClientConfig({
110110 if ( typeof window === "undefined" || to . path === from . path || removeHtml ( to . path ) === removeHtml ( from . path ) ) return ;
111111 const esData = findEsMeta ( to ) ;
112112 const a = window . analytics ;
113+ if ( a ) {
113114 setTimeout ( ( ) => {
114115 a . page ( {
115116 site : "docs" ,
@@ -120,6 +121,7 @@ export default defineClientConfig({
120121 $host : window . location . hostname
121122 } ) ;
122123 } , 1000 ) ;
124+ }
123125 } ) ;
124126 router . beforeEach ( ( to , from ) => leave ( to , from ) ) ;
125127 } ,
You can’t perform that action at this time.
0 commit comments