Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"gray-matter": "^4.0.3",
"leaflet": "^1.9.4",
"lodash-es": "^4.18.1",
"nuxt": "~4.4.8",
"nuxt": "~4.5.2",
"nuxt-og-image": "^6.7.2",
"ofetch": "^1.5.1",
"papaparse": "^5.5.4",
Expand Down
17 changes: 0 additions & 17 deletions patches/@nuxt__nitro-server.patch

This file was deleted.

15 changes: 10 additions & 5 deletions plugins/matomo.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,24 @@ const noopMatomo = {
}

export default defineNuxtPlugin({
async setup(nuxtApp) {
async setup() {
const _paq = (window._paq = window._paq || [])
if (!_paq) return { provide: { matomo: noopMatomo } }

let u = nuxtApp.$config.public.matomo.host
const debug = nuxtApp.$config.public.matomo.debug
const dryRun = nuxtApp.$config.public.matomo.dryRun
// `useRuntimeConfig()` rather than `nuxtApp.$config`: `NuxtApp` is typed from every
// plugin's injections, so reading config off it makes this plugin's own injected type
// circular. TypeScript then widens the whole injection intersection to `any` and every
// `$api` / `$t` in the app silently loses its type.
const config = useRuntimeConfig()
let u = config.public.matomo.host
const debug = config.public.matomo.debug
const dryRun = config.public.matomo.dryRun
if (!u) return { provide: { matomo: noopMatomo } }

u = u.endsWith('/') ? u : u + '/'
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['setTrackerUrl', u + 'matomo.php'])
_paq.push(['setSiteId', nuxtApp.$config.public.matomo.siteId])
_paq.push(['setSiteId', config.public.matomo.siteId])
_paq.push(['enableLinkTracking'])

try {
Expand Down
Loading
Loading