Hello,
i’m using matomo on a script that is loaded on various client websites. There is a conflict when the client also using matomo.
For this i used the ‘addtracker’ function which is working great. But this new tracker take the configuration from the orginal tracker that usually has ‘trackPageView’ enabled. And as it is not my site i don’t want them.
But I didn’t find any way to deactivate it on a tracker. Could you please help me ?
Here is my code:
export const initMatomo = () => {
const _paq = (window._paq = window._paq || [])
;(function () {
const u = MATOMO_SITE_URL
_paq.push(['addTracker', u + '/matomo.php', MATOMO_SITE_ID])
const d = document,
g = d.createElement('script'),
s = d.getElementsByTagName('script')[0]
g.type = 'text/javascript'
g.async = true
g.src = u + '/matomo.js'
s.parentNode.insertBefore(g, s)
})()
window.please = {}
window.please.track = function (ary) {
const matomo = window.Matomo
if (matomo) {
const matomoTracker = matomo.getTracker(MATOMO_SITE_URL + '/matomo.php', MATOMO_SITE_ID)
matomoTracker.trackEvent(ary[0], ary[1], ary[2], ary[3])
}
}
}