File tree 1 file changed +10
-8
lines changed
1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change 1
1
'use client'
2
2
3
3
import * as Swetrix from 'swetrix'
4
- import { Suspense } from 'react'
4
+ import { useEffect , Suspense } from 'react'
5
5
import { usePathname } from 'next/navigation'
6
6
7
7
function SwetrixComponent ( ) {
8
8
const pathname = usePathname ( )
9
9
10
- if ( window . location . host === 'briefkastenhq.com' ) {
11
- Swetrix . init ( process . env . NEXT_PUBLIC_SWETRIX_PROJECT , {
12
- apiURL : process . env . NEXT_PUBLIC_SWETRIX_API_HOST ,
13
- } )
14
- let url = pathname
15
- Swetrix . trackPageview ( url )
16
- }
10
+ useEffect ( ( ) => {
11
+ if ( window . location . host === 'briefkastenhq.com' ) {
12
+ Swetrix . init ( process . env . NEXT_PUBLIC_SWETRIX_PROJECT , {
13
+ apiURL : process . env . NEXT_PUBLIC_SWETRIX_API_HOST ,
14
+ } )
15
+ let url = pathname
16
+ Swetrix . trackPageview ( url )
17
+ }
18
+ } , [ pathname ] )
17
19
return < div > </ div >
18
20
}
19
21
You can’t perform that action at this time.
0 commit comments