File tree Expand file tree Collapse file tree 5 files changed +70
-10
lines changed
Expand file tree Collapse file tree 5 files changed +70
-10
lines changed Original file line number Diff line number Diff line change 1212 "license" : " ISC" ,
1313 "description" : " " ,
1414 "dependencies" : {
15- "next" : " ^14.2.15" ,
16- "nextra" : " ^3.0.15" ,
17- "nextra-theme-docs" : " ^3.0.15" ,
18- "react" : " ^18.3.1" ,
19- "react-dom" : " ^18.3.1" ,
20- "react-spinners" : " ^0.13.8"
15+ "next" : " ^14.2.15" ,
16+ "nextra" : " ^3.0.15" ,
17+ "nextra-theme-docs" : " ^3.0.15" ,
18+ "react" : " ^18.3.1" ,
19+ "react-dom" : " ^18.3.1" ,
20+ "react-spinners" : " ^0.13.8"
2121 },
2222 "devDependencies" : {
2323 "@types/react" : " 18.2.38" ,
Original file line number Diff line number Diff line change 99 "lint" : " next lint"
1010 },
1111 "dependencies" : {
12+ "fathom-client" : " ^3.7.2" ,
1213 "lucide-react" : " ^0.454.0" ,
1314 "next" : " 15.0.2" ,
1415 "react" : " 19.0.0-rc-02c0e824-20241028" ,
Original file line number Diff line number Diff line change 11import type { Metadata } from "next" ;
22import "./globals.css" ;
3+ import Fathom from "@/component/Fathom" ;
34
45export const metadata : Metadata = {
56 title : "Peppermint" ,
6- description : "Peppermint is a self-hosted issue tracker for your projects or help desk." ,
7+ description :
8+ "Peppermint is a self-hosted issue tracker for your projects or help desk." ,
79} ;
810
911export default function RootLayout ( {
@@ -13,9 +15,8 @@ export default function RootLayout({
1315} > ) {
1416 return (
1517 < html lang = "en" >
16- < body
17- className = { `antialiased` }
18- >
18+ < body className = { `antialiased` } >
19+ < Fathom />
1920 { children }
2021 </ body >
2122 </ html >
Original file line number Diff line number Diff line change 1+ // Fathom.tsx
2+ "use client" ;
3+
4+ import { load , trackPageview } from "fathom-client" ;
5+ import { useEffect , Suspense } from "react" ;
6+ import { usePathname , useSearchParams } from "next/navigation" ;
7+
8+ function TrackPageView ( ) {
9+ const pathname = usePathname ( ) ;
10+ const searchParams = useSearchParams ( ) ;
11+
12+ // Load the Fathom script on mount
13+ useEffect ( ( ) => {
14+ //@ts -ignore
15+ load ( process . env . NEXT_PUBLIC_FATHOM_ID , {
16+ auto : false ,
17+ } ) ;
18+ } , [ ] ) ;
19+
20+ // Record a pageview when route changes
21+ useEffect ( ( ) => {
22+ if ( ! pathname ) return ;
23+
24+ trackPageview ( {
25+ url : pathname + searchParams ?. toString ( ) ,
26+ referrer : document . referrer ,
27+ } ) ;
28+ } , [ pathname , searchParams ] ) ;
29+
30+ return null ;
31+ }
32+
33+ export default function Fathom ( ) {
34+ return (
35+ < Suspense fallback = { null } >
36+ < TrackPageView />
37+ </ Suspense >
38+ ) ;
39+ }
Original file line number Diff line number Diff line change @@ -7887,6 +7887,7 @@ __metadata:
78877887 nextra-theme-docs: "npm:^3.0.15"
78887888 react: "npm:^18.3.1"
78897889 react-dom: "npm:^18.3.1"
7890+ react-spinners: "npm:^0.13.8"
78907891 languageName: unknown
78917892 linkType: soft
78927893
@@ -8987,6 +8988,13 @@ __metadata:
89878988 languageName: node
89888989 linkType: hard
89898990
8991+ "fathom-client@npm:^3.7.2":
8992+ version: 3.7.2
8993+ resolution: "fathom-client@npm:3.7.2"
8994+ checksum: 10c0/f198669fba3aa14c4f1adc2b5afdce282503945fe3ac3d842ab7a6d46c90cf4a703ccad99abcbc71faa095348d9940a2d1aa0cf718c58e4d8479fa5dcb88aff2
8995+ languageName: node
8996+ linkType: hard
8997+
89908998"fault@npm:^2.0.0":
89918999 version: 2.0.1
89929000 resolution: "fault@npm:2.0.1"
@@ -11287,6 +11295,7 @@ __metadata:
1128711295 "@types/react-dom": "npm:^18"
1128811296 eslint: "npm:^8"
1128911297 eslint-config-next: "npm:15.0.2"
11298+ fathom-client: "npm:^3.7.2"
1129011299 lucide-react: "npm:^0.454.0"
1129111300 next: "npm:15.0.2"
1129211301 postcss: "npm:^8"
@@ -15171,6 +15180,16 @@ __metadata:
1517115180 languageName: node
1517215181 linkType: hard
1517315182
15183+ "react-spinners@npm:^0.13.8":
15184+ version: 0.13.8
15185+ resolution: "react-spinners@npm:0.13.8"
15186+ peerDependencies:
15187+ react: ^16.0.0 || ^17.0.0 || ^18.0.0
15188+ react-dom: ^16.0.0 || ^17.0.0 || ^18.0.0
15189+ checksum: 10c0/59a030ece288f045a443e0b720c94636fc00667bcb8cd5a36ed8342cc2bc52a98106a676875551b3389ae5943bd7c4d4aa2ede0fb914bbde4322211f0f0120a8
15190+ languageName: node
15191+ linkType: hard
15192+
1517415193"react-style-singleton@npm:^2.2.1":
1517515194 version: 2.2.1
1517615195 resolution: "react-style-singleton@npm:2.2.1"
You can’t perform that action at this time.
0 commit comments