Are custom variables available from Tag Manager (in Matomo v4)?

Hi,
I activated “custom variable” from the marketplace but I don’t find any way to use it from the Tag Manager? Does Matomo definitively replace “custom variable” by “custom dimension”?

(I only find very old posts on custom variables so I am wondering)

Hi,
you can use Custom Dimensions as well as Custom Variables.
It is recommended to use Custom Dimensions.
As you are using Tag Manager you just need to add them to your Settings Variable.
And also you need to create and activate them in the Matomo Settings.

Custom Variables you can calculate via backend or Tag Manager and push directly to Matomo.

Let me know if you need any support.

Hi,

Thank you for responding.
I don’t understand why Custom Dim. would be more interesting than Custom Var.
As for my case I would like to add the ratio of visible content vs content height to the pageview hit.

I added this information as a Custom Dim. but like this, the most important data is the ratio and secondary data is the page. I want to see a mean of that ratio for each page.
So I think that Custom Var. would be more relevant.

But in the Tag Manager, I cannot add Custom Var in the Matomo Variable nor in the Matomo Tag.
May be I just need to learn how to do this… :blush:

@Trackingninja How is it possible to push the setCustomVariable in the Tag Manager?
'setCustomVariable' needs a following 'trackPageView' or 'trackEvent' but in my Tag Manager is another PageView tag configured so I don’t want to send a second PageView after setCustomVariable .

See here please:

Maybe what you can do is use a tag that just initialize the MTM on the page view:


Then do your stufs with _paq (indeed, it seems _paq is not read while the first tag has not been called)
And then call an event in _mtm that will trigger a real page view…

Thank you very much, that helped.

  1. Matomo Analytics Tags (after trigger PageView), only for initializing, Priority 1
  2. My custom html Tag with _paq.push(['setCustomVariable', i+1, 'Kategorie',a_Obj.text, 'page']); // Priority 99
  3. Matomo Analytics Tag with TrackPageView (after trigger PageView) // Priority 999

Sorry for replying so late.
It seems you already found a working solution.

It’s kind of what I would have suggested.
In case you can control anything tracking related via back-end logic this is the most suitable option.