AmazingDreams / vue-matomo

Vue plugin for Matomo Analytics
MIT License
274 stars 61 forks source link

The average page generation time is incorrect #77

Closed gaoyaowang closed 3 years ago

gaoyaowang commented 3 years ago

1

My page generation time is 30 to 50 milliseconds, which is not in line with the actual situation!

My approach is: 2 Because my routing parameters are too long, I can't use router: router,

So I do this in components 3

What's wrong with what I wrote? What kind of configuration is missing Sorry, my English is not very good. I hope you can understand my problem

AmazingDreams commented 3 years ago

Hello, your English is fine! You may be interested in the Matomo docs on SPA, specifically on setting the page generation time https://developer.matomo.org/guides/spa-tracking#updating-the-generation-time

gaoyaowang commented 3 years ago

Sorry, I couldn't get back to you in time, I've tried this, this.$matomo.setGenerationTimeMs(loadTime); I use window.performance.timing To get the load time,But Vue is a single page application,Route switching, using window.performance.timing The correct load time cannot be obtained.Do you have any good suggestions or methods?

AmazingDreams commented 3 years ago

Not really. I think your best option is to set the current time at the start of a component mounted method, then after the component is done loading async data calculate the loading time. However this means you have to manually register page views etc. I think it's possible to create some utility methods in vue-matomo to aid with this setup, but I can't see a way to do this within this library entirely as we don't know what your app is doing.

gaoyaowang commented 3 years ago

My app is using Vue matomo to count all kinds of main indicators to achieve the purpose of data analysis. However, as I said earlier, the problem I am facing now is that the page loading time of matomo statistics is incorrect. At present, I can only set it manually.

Thank you for providing me with some directions. Thank you very much!