Changing Matomo configuration properties within Matomo Tag Manager


In one of projects I use Matomo Tag Manager and Matomo (cloud version). Matomo Pageview tag gets its’ properties (site ID, etc.) from Matomo Configuration variable I defined.

I would like to know what is the correct way to initialize Matomo Pageview with some custom settings like when you do it via page code:


But instead of putting something into page code I want to set/change config parameters in Matomo Tag Manager.

I guess it can be done by creating custom HTML tag (which will have JS code above) with top priority, but it feels more like a hack. What is the proper way to do it in Matomo Tag Manager?

I’m fully aware that self-hosted Matomo INI config is described here:

But as a paying customer of Matomo Cloud I’m really missing clear instructions on following:

  • where and how can I get the initial config values (possible browser console dump for debugging, etc)
  • how to overwrite default config values when using Matomo Cloud & Matomo Tag Manager combo

I tried to create a workaround, but it’s not working. I created :

  • tag type: custom HTML tag
  • position: Head End
  • trigger: Pageview
  • priority: higher than general Matomo Pageview Tag - by this I’m hoping to achieve that it runs before “trackPageView”, but not sure if it works.
var _paq = window._paq = window._paq || [];
_paq.push(['setCampaignKeywordKey', 'kw']);
_paq.push(['setCampaignNameKey', 'cpn']);
console.log("Keyword detected and variable set.");

Then opening

Still nothin appears in activity logs, neither in Campaigns report. I think I exhausted possibilities and without proper documentation and/or advice I’m lost.

Any advice? Thanks, Alex

Even when I put the code directly into page template right after , before anything is started… no luck :frowning_face: