Custom Data-Layer Array Name - Tag Manager

I know that Matomo Tag Manager supports Google’s data layer in some instances, where it is defined on the page as follows:

dataLayer = [{‘some_key’:‘some_value’}];

However, you still need to use the _mtm.push method for asynchronous events since dataLayer.push is not picked up by Matomo (that I am aware of, I am a new user but have been in tag management for years with Tealium and GTM). Plus it creates the use of two separately named arrays when one array of objects as a single data layer array of objects would be ideal.

It would be excellent to have a configuration setting where you could define the name of your data layer array (dataLayer, digitalData, utag_data, etc.) to make it easier to leverage vendor-agnostic or other vendor data layers when converting a site from another vendor to Matomo, instead of having to go into the code and replace all instances of dataLayer.push with _mtm.push (which is just find and replace, but still another step where you have to touch the code in multiple places and test).

Thank you and if this feature already exists or my limited knowledge with Matomo is overlooking a work-around, please let me know.

2 Likes