Skip to content

Matomo not tracking on navigation #448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Honigbrot opened this issue Apr 23, 2025 · 0 comments
Open

Matomo not tracking on navigation #448

Honigbrot opened this issue Apr 23, 2025 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@Honigbrot
Copy link

📚 What are you trying to do?

I've been trying to setup Matomo tracking but it only tracks the pageview on hard refreshes.

🔍 What have you tried?

So far I've created a client plugin (url omitted).

export default defineNuxtPlugin((nuxtApp) => {
    const router = useRouter()

    const {proxy} = useScriptMatomoAnalytics({
        matomoUrl: 'https://',
        siteId: '1',
        disableCookies: true,
        enableLinkTracking: true,
        trackPageView: false
    })

    if (process.client) {
        router.afterEach((to) => {
            setTimeout(() => {
                proxy._paq.push(['setDocumentTitle', document.title])
                proxy._paq.push(['setCustomUrl', window.location.pathname + window.location.search])
                proxy._paq.push(['trackPageView'])
            }, 100)
        })
    }
})

I've also tried a nuxt finish hook and a watcher without success.

ℹ️ Additional context

No response

@Honigbrot Honigbrot added the help wanted Extra attention is needed label Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant