-
Notifications
You must be signed in to change notification settings - Fork 15
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
setting route.meta.matomo has no effect with SSR #7
Comments
Sorry for the late response, could you maybe share some code that explains a bit what you are trying to do? |
Yes. Roughly this (only the relevant parts retained) // middleware that runs for some pages/layouts
export default async (context: Context) => {
const { store, route } = context;
// get the current user
const {viewer} = store.state;
// this runs, but has no effect when coming from SSR'd page. It only has an effect on subsequent runs on the client
route.meta.matomo = {
userId: ["setUserId", viewer.id],
userTypeVar: ["setCustomVariable", 1, "UserName", viewer.name],
}
} Ideally, |
I am not really sure that that is something this module should/could support. Eg if your middleware would be executed at page load (but it isnt, see below) then the meta should be re-applied and only vuex state would need to be hydrated. Unfortunately it seems calling route middlewares on hydration is just not supported, the workaround is to add a client side plugin but I am not sure you have access to the route.meta there. See this topic and the linked comment for more info: nuxt/nuxt#2653 (comment) |
Related Nuxt rfc: nuxt/rfcs#28 |
When running a universal app, setting
route.meta.matomo
in a middleware has no effect when the page renders first on the server.Obviously, matomo is unlikely to work on the server, but is there a way to have this module apply
route.meta.matomo
when the page is evaluated on the client?The text was updated successfully, but these errors were encountered: