Using vue-matomo and Plugins like Heatmap

Hi,

I have a vue SPA where I use vue-matomo to track Events. Since I only want to perform actual trackercode JS and things, I have a consent requirement, so it works like this:

        methods: {
            initMatomo() {
                if (!this.isMatomoInit && !this.disableMatomoTracking) {
                  Vue.use(VueMatomo, {
                        host: 'https://my.domain.com/piwik/',
                        siteId: 9,
                        trackerFileName: 'matomo',
                        router: false,
                        enableLinkTracking: false,
                        requireConsent: true,
                        trackInitialView: false,
                        debug: this.matomoDebug
                    }, {inject: false});
                    this.isMatomoInit = true;
                    return true;
                } else {
                  return false;
                }
            },
        }

Now I want to use the Heatmap Plugin (Heatmap & Session Recording - Matomo Plugins Marketplace). I found the problem seems to be that vue-matomo uses its own matomo.js code for the tracker API instead of requiring the file from the tracker Server.

I am not fluent with vue-apps, but I assume there should be a possibility to load the distinct tracking file enhancement (my.domain.com/piwik/plugins/HeatmapSessionRecording/tracker.min.js) at some point after or before the Vue.Use() statement, so that it adds to the API?

Thanks for any help!

Hi,

vue-matomo isn’t maintained by the Matomo team, so it is probably easier if you ask the author for help (or invite them to answer here)

You are right that the Premium-plugin JS needs to load for them to work.

You are right of course; I was hoping the central matomo forum would be the best fit for developers facing the same issue.

As a matter of fact I did see that recently an update to vue-matomo has been released that addresses my problem. It now uses the servers JS API instead of a bundled one. Now all is working as intended.

(I just have to make sure to use window._paq before the API is loaded and this.$matomo after its available)

Thanks for taking your time to reply.

1 Like