Skip to content

Instantly share code, notes, and snippets.

@bschulz87
Created February 12, 2019 15:15
Show Gist options
  • Save bschulz87/d82661c29c7278a848f54ed6d4ed6705 to your computer and use it in GitHub Desktop.
Save bschulz87/d82661c29c7278a848f54ed6d4ed6705 to your computer and use it in GitHub Desktop.
vue-matomo with external tracking client
<!DOCTYPE html>
<html lang="en">
<head>
<!-- ... --->
<script src="https://my.matomo.cloud/matomo.js"></script>
<!-- ... --->
</head>
<body>
<!-- ... --->
</body>
</html>
import MatomoJS from 'matomo' // use external module
const defaultOptions = {
debug: false,
enableLinkTracking: true,
requireConsent: false,
trackInitialView: true,
trackerFileName: 'piwik'
}
export default function install (Vue, setupOptions = {}) {
// ...
}
// vue.config.js
module.exports = {
// ...
chainWebpack: config => {
config.externals({
matomo: 'AnalyticsTracker',
});
},
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment