Я использую плагин Vue для Matomo, который находится здесь: https://github.com/AmazingDreams/vue-matomo
Я импортировал плагин VueMatomo в мой файл ввода main.js следующим образом:
import VueMatomo from 'vue-matomo';
ЗатемЯ назначаю VueMatomo как глобальный метод в моем файле main.js следующим образом:
Vue.use(VueMatomo, {
// Configure your matomo server and site
host: 'https://matomo.example.com',
siteId: 1,
// Enables link tracking on regular links. Note that this won't
// work for routing links (ie. internal Vue router links)
// Default: true
enableLinkTracking: true,
// Require consent before sending tracking information to matomo
// Default: false
requireConsent: false,
// Whether to track the initial page view
// Default: true
trackInitialView: true,
// Changes the default .js and .php endpoint's filename
// Default: 'piwik'
trackerFileName: 'piwik',
// Whether or not to log debug information
// Default: false
debug: false
});
Как реализовать теги в этом плагине?Могу ли я просто установить trackerUrl в свой URL-адрес контейнера следующим образом:
// Overrides the autogenerated tracker endpoint entirely
// Default: undefined
trackerUrl: 'https://mycontainer.js'
Также, как мне отправлять пользовательские данные.Например:
'user':{
'role':'consumer',
'type':'purchaser'
}
edit: в документации менеджера тегов Matomo сказано, чтобы поместить это в тег head.
<!-- MTM -->
<script type="text/javascript">
var _mtm = _mtm || [];
_mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'});
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src='https://mycontainer.js'; s.parentNode.insertBefore(g,s);
</script>
<!-- End MTM -->
То же самое требуется для плагина vue-matomoили вы можете поставить
g.src='https://mycontainer.js'
где-нибудь еще?