-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Doesn't work with vue3 + Inertia #136
Comments
Ziggy doesn't provide routing like the Vue Router does. Ziggy is just a help in terms of using named routes from Laravel.
My solution has been the following: import VueMatomo from 'vue-matomo'
createInertiaApp({
title: (title) => `${title} - ${appName}`,
resolve: (name) => resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob('./Pages/**/*.vue')),
setup({el, App, props, plugin, title}) {
const app = createApp({render: () => h(App, props)})
.use(plugin)
.use(ZiggyVue)
.use(VueMatomo, {
host: 'https://matomo.example.com',
siteId: 1,
})
.mount(el);
router.on('navigate', (event) => {
window._paq.push(['trackPageView']);
// If you want to track users as well
if(event.detail.page.props.auth.user) {
window._paq.push(['setUserId', page.props.auth.user.id]);
}
});
return app;
},
progress: {
color: '#4B5563',
},
}); |
@Repox Your implementation seems to work but not fully, i do have some logs on my matomo dashboard but not every pages visited are logged ... |
This is how i fixed the issue with Vue2 + Inertia + Ziggy + Vite:
With the following line:
I have been able to fix the issue where i see on the matomo dashboard a user navigating always on the same url while he actually navigate to differente pages |
I can't get it to work, because Inertia uses Ziggy route function to pass the routes instead of the default vue router.
Does anyone have an example for working with inertia?
The text was updated successfully, but these errors were encountered: