Skip to content

Commit

Permalink
fix: use only pathname
Browse files Browse the repository at this point in the history
  • Loading branch information
ndom91 committed Jul 11, 2024
1 parent 9815650 commit 4862a14
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/components/analytics.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@

import * as Swetrix from 'swetrix'
import { Suspense } from 'react'
import { usePathname, useSearchParams } from 'next/navigation'
import { usePathname } from 'next/navigation'

function SwetrixComponent() {
const pathname = usePathname()
const searchParams = useSearchParams()

if (window.location.host === 'briefkastenhq.com') {
Swetrix.init(process.env.NEXT_PUBLIC_SWETRIX_PROJECT, {
apiURL: process.env.NEXT_PUBLIC_SWETRIX_API_HOST,
})
let url = pathname
if (searchParams.toString() !== '') {
url += `?${searchParams.toString()}`
}
Swetrix.trackPageview(url)
}
return <div></div>
Expand Down

0 comments on commit 4862a14

Please sign in to comment.