Tag Manager with Vue

(Josh Forcier) #1

Has anyone implemented the Tag Manager with a Vue.js website? I was able to implement Matomo analytics with vue-matomo, but how do I use containers with the plugin? Would I just set the trackerUrl to my container url?

Also how do I push additional data with vue-matomo, such as this:

            'loginState':'anonymous', // logged-in or anonymous
            'role':'consumer - no role assigned', // role or group assigned              

I have this in my main.js file:

Vue.use(VueMatomo, {
// Configure your matomo server and site
host: 'https://mysite.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',

// Overrides the autogenerated tracker endpoint entirely
// Default: undefined
trackerUrl: 'https://mycontainer',

// Whether or not to log debug information
// Default: false
debug: false,

(Lukas Winkler) #2


Where exactly is the issue? How are you using vue?

You should be able to simply either add it to your index.html or if you let vue/webpack generate the index.html, then add it to the template.

(Josh Forcier) #3

I edited my original post.