File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { baseOptions } from "@/app/layout.config";
66import { Button } from "@/components/ui/button" ;
77import { useEffect , useState } from 'react' ;
88import newGithubIssueUrl from "new-github-issue-url" ;
9+ import posthog from 'posthog-js' ;
910
1011function createGitHubIssueURL ( path : string | null ) {
1112 return newGithubIssueUrl ( {
@@ -28,7 +29,15 @@ export default function NotFound() {
2829 useEffect ( ( ) => {
2930 if ( typeof window !== 'undefined' ) {
3031 const path = window . location . pathname ;
32+ const referrer = document . referrer ;
3133 setCurrentPath ( path ) ;
34+
35+ // Track 404 page view in PostHog
36+ posthog . capture ( '404_page_not_found' , {
37+ path : path ,
38+ referrer : referrer || 'direct' ,
39+ url : window . location . href ,
40+ } ) ;
3241 }
3342 } , [ ] ) ;
3443
@@ -84,4 +93,4 @@ export default function NotFound() {
8493 </ div >
8594 </ HomeLayout >
8695 ) ;
87- }
96+ }
You can’t perform that action at this time.
0 commit comments