Is it possible to use the _paq array in Tag Manager to push setCustomVariable?

I want to set a CustomVariable (setCustomVariable) in a Custom HTML Tag in the Tag Manager.
... _paq.push(['setCustomVariable', 1, 'Kategorie','News', 'page']); _paq.push(['setCustomVariable', 1, 'Kategorie','Sport', 'page']);

When I access the _paq array in the Custom HTML Tag, however, nothing happens, although the Tag Manager later triggers the necessary trackPageView: but the request with the trackPageView does not contain the custom variable.

It looks like there is a paq array, but it is not properly initialized.

Why don’t you use Custom dimensions instead of Custom variables as:

  • Custom variables are deprecated and replaced by custom dimensions
  • Custom dimensions are very well supported by MTM

Custom Dimensions User Guide - Analytics Platform - Matomo

Tag Manager User Guide - Analytics Platform - Matomo

@heurteph-ei
Yes, Custom dimensions are fine.

But I need a Custom variable because of the one described reason here:

The only use case where it would make sense to use Custom Variables instead of Custom Dimensions is when a given dimension can have multiple values for a same visitor or page. For example, if you want to track Page categories and a given page or article has more than 1 category. Custom Dimensions feature does not support multiple values per dimension, but you can store multiple values for a same custom variable.

Thank you for you help!

@ForAll: Solution can be found here