1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-22 17:23:22 +01:00

matomo fixes

This commit is contained in:
Matthias Kretschmann 2022-11-16 21:13:10 +00:00
parent d4e3f66f23
commit 9a32ff4c63
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 33 additions and 0 deletions

32
src/@types/matomo.d.ts vendored Normal file
View File

@ -0,0 +1,32 @@
interface Dimensions {
dimension1?: string
dimension2?: string
dimension3?: string
dimension4?: string
dimension5?: string
dimension6?: string
dimension7?: string
dimension8?: string
dimension9?: string
dimension10?: string
}
declare global {
interface Window {
_paq?:
| (
| Dimensions
| number[]
| string[]
| number
| string
| null
| undefined
)[][]
| null
}
}
window._paq = window._paq || {}
export {}

View File

@ -14,6 +14,7 @@ export default function Site({ children }: { children: React.ReactNode }) {
// init Matomo tracking // init Matomo tracking
useEffect(() => { useEffect(() => {
if (window._paq) return
init({ url: meta.matomoUrl, siteId: meta.matomoSite }) init({ url: meta.matomoUrl, siteId: meta.matomoSite })
}, []) }, [])