AmazingDreams / vue-matomo

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

_paq.push Error but this.$matomo can work in component #33

Closed StinsonZhao closed 5 years ago

StinsonZhao commented 5 years ago

In my main.js(entry js):

import * as VueMatomo from 'vue-matomo'
Vue.use(VueMatomo, {
  host: 'myhost',
  siteId: 3,
  trackerFileName: 'piwik',
  router: router,
  enableLinkTracking: true,
  requireConsent: false,
  trackInitialView: true,
  debug: true
})

// for test, but it report an error
window._paq.push(["trackEvent", "something", "Click", 'span'])

Then I called window._paq.push(["trackEvent", "something", "Click", 'span']) in browser console, it also emited an error.

Error:

_paq.push() was used but Piwik tracker was not initialized before the piwik.js file was loaded. Make sure to configure the tracker via _paq.push before loading piwik.js. Alternatively, you can create a tracker via Piwik.addTracker() manually and then use _paq.push but it may not fully work as tracker methods may not be executed in the correct order.

image

liuhuanhui commented 5 years ago

i an

upandfine commented 5 years ago

same here! (With gridsome)

AmazingDreams commented 5 years ago

Please try again with the latest version