Created
February 12, 2019 15:15
-
-
Save bschulz87/d82661c29c7278a848f54ed6d4ed6705 to your computer and use it in GitHub Desktop.
vue-matomo with external tracking client
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<!-- ... ---> | |
<script src="https://my.matomo.cloud/matomo.js"></script> | |
<!-- ... ---> | |
</head> | |
<body> | |
<!-- ... ---> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = {}) { | |
// ... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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