AmazingDreams / vue-matomo

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

Page title are displayed in english, even if I change language on my app #91

Closed frintezadev closed 2 years ago

frintezadev commented 3 years ago

My config : Vue.use(VueMatomo, { // Configure your matomo server and site by providing host: 'myhost.com', siteId: 10, trackerFileName: 'piwik', router, enableLinkTracking: true, requireConsent: false, trackInitialView: true, disableCookies: false, requireCookieConsent: false, enableHeartBeatTimer: false, heartBeatTimerInterval: 15, debug: false, userId: undefined, cookieDomain: undefined, domains: undefined, preInitActions: [], }); My routes are declared like that : { path: '/login', name: 'login', meta: { title: i18n.t('login.title'), public: true, }, component: () => import(/* webpackChunkName: "auth" */ '@/views/Auth/Login.vue'), },

Now the problem is even if I change the language in my app, in matomo interface I have page title = name of page in english

Second problem, I have : setUser(user) { localStorage.setItem(USER_KEY, JSON.stringify(user)); this.timeoutUntilPiwikSet(0); }, timeoutUntilPiwikSet(counter) { // People might have a tracking blocker and it won't ever load if (counter > 100) { console.error('Waiting for $matomo timed out'); return; } if (this.$matomo) { console.log(this.$matomo); } else { console.log('Else'); setTimeout(() => { this.timeoutUntilPiwikSet(counter + 1); }, 100); } }, And always my this.$matomo is undefined. @AmazingDreams you have an idea about that ? Thx in advance

AmazingDreams commented 3 years ago

I think that { title: i18n.t('login.title') is only evaluated at startup, by the time it gets to vue-matomo it is a raw string.

As for your second problem, maybe you lost the this context? Otherwise I don't know