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.
In my main.js(entry js):
Then I called
window._paq.push(["trackEvent", "something", "Click", 'span'])
in browser console, it also emited an error.Error: