vue-matomo
Advanced tools
Comparing version 3.12.0-1 to 3.12.0-2
{ | ||
"name": "vue-matomo", | ||
"version": "3.12.0-1", | ||
"version": "3.12.0-2", | ||
"description": "Link your Piwik/Matomo installation", | ||
@@ -5,0 +5,0 @@ "author": "Dennis Ruhe <dennis@amazingsystems.nl>", |
@@ -8,3 +8,3 @@ import { buildBaseUrl } from './utils' | ||
trackInitialView: true, | ||
trackerFileName: 'piwik', | ||
trackerFileName: 'matomo', | ||
trackerUrl: undefined, | ||
@@ -40,7 +40,4 @@ userId: undefined | ||
function initMatomo(Vue, options) { | ||
const { host, siteId, trackerFileName, trackerUrl } = options | ||
const trackerEndpoint = trackerUrl || `${host}/${trackerFileName}.php`; | ||
const Matomo = window.Piwik.getAsyncTracker() | ||
const Matomo = window.Piwik.getTracker(trackerEndpoint, siteId) | ||
// Assign matomo to Vue | ||
@@ -50,10 +47,2 @@ Vue.prototype.$piwik = Matomo | ||
if (options.requireConsent) { | ||
Matomo.requireConsent() | ||
} | ||
if (options.userId) { | ||
Matomo.setUserId(options.userId) | ||
} | ||
if (options.trackInitialView) { | ||
@@ -64,6 +53,2 @@ // Register first page view | ||
if (options.enableLinkTracking) { | ||
Matomo.enableLinkTracking() | ||
} | ||
// Track page navigations if router is specified | ||
@@ -94,7 +79,25 @@ if (options.router) { | ||
const { host, trackerFileName } = options | ||
const { host, siteId, trackerFileName, trackerUrl } = options | ||
const trackerScript = `${host}/${trackerFileName}.js` | ||
const trackerEndpoint = trackerUrl || `${host}/${trackerFileName}.php`; | ||
window._paq = window._paq || [] | ||
if (options.requireConsent) { | ||
window._paq.push(['requireConsent']) | ||
} | ||
if (options.userId) { | ||
window._paq.push(['setUserId', options.userId]) | ||
} | ||
if (options.enableLinkTracking) { | ||
window._paq.push(['enableLinkTracking']) | ||
} | ||
window._paq.push(['setTrackerUrl', trackerEndpoint]) | ||
window._paq.push(['setSiteId', siteId]) | ||
loadScript(trackerScript) | ||
.then(() => initMatomo(Vue, options)) | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
831373
24916